diff options
Diffstat (limited to 'lumina-desktop/desktop-plugins')
13 files changed, 37 insertions, 36 deletions
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp index 0fec17c6..b238a207 100644 --- a/lumina-desktop/desktop-plugins/LDPlugin.cpp +++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp @@ -42,7 +42,7 @@ void LDPlugin::setupMenu(){ menu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove Item"), this, SLOT(slotRemovePlugin()) ); } -void LDPlugin::setInitialSize(int width, int height){ +/*void LDPlugin::setInitialSize(int width, int height){ //Note: Only run this in the plugin initization routine: // if the plugin is completely new (first time used), it will be this size if(settings->allKeys().filter(prefix+"location").isEmpty()){ @@ -54,12 +54,4 @@ void LDPlugin::setInitialSize(int width, int height){ } //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/LDPlugin.h b/lumina-desktop/desktop-plugins/LDPlugin.h index d1a9c743..6a3c82a1 100644 --- a/lumina-desktop/desktop-plugins/LDPlugin.h +++ b/lumina-desktop/desktop-plugins/LDPlugin.h @@ -47,8 +47,11 @@ public: return PLUGID; } - void setInitialSize(int width, int height); - //void adjustSize(int width, int height); + virtual QSize defaultPluginSize(){ + //This needs to be re-implemented in the subclassed plugin + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(1,1); //1x1 grid size + } void savePluginGeometry(QRect geom){ settings->setValue(prefix+"geometry/desktopGridPoints", geom); diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp index c0f868e2..4b3210a5 100644 --- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp @@ -15,25 +15,10 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); lay->addWidget(button, 0, Qt::AlignCenter); connect(button, SIGNAL(DoubleClicked()), this, SLOT(buttonClicked()) ); - //menu = new QMenu(this); - /*int icosize = this->readSetting("iconsize",-1).toInt(); - if(icosize <1){ - icosize = LSession::handle()->sessionSettings()->value("DefaultIconSize",64).toInt(); - this->saveSetting("iconsize",icosize); - }*/ - //int icosize - //button->setIconSize(QSize(icosize,icosize)); button->setContextMenuPolicy(Qt::NoContextMenu); - //connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(openContextMenu()) ); watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) ); - //Calculate the initial size of the button - //qDebug() << "Button Size:" << button->size(); - //qDebug() << "Calculated:" << icosize+4 << icosize+8+qRound(2.15*button->fontMetrics().height()); - //qDebug() << "Preferred Size:" << button->sizeHint(); - //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(120, 100); //give the container a bit of a buffer + QTimer::singleShot(200,this, SLOT(loadButton()) ); } @@ -49,7 +34,7 @@ void AppLauncherPlugin::loadButton(){ QString path = this->readSetting("applicationpath",def).toString(); //use the default if necessary //qDebug() << "Default Application Launcher:" << def << path; bool ok = QFile::exists(path); - int icosize = this->width()/1.8; //This is the same calculation as in the LDesktopPluginSpace + int icosize = this->height()-4 - 2.2*button->fontMetrics().height(); button->setFixedSize( this->width()-4, this->height()-4); button->setIconSize( QSize(icosize,icosize) ); QString txt; diff --git a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp index 459e4610..4d293b39 100644 --- a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp +++ b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp @@ -262,7 +262,6 @@ AudioPlayerPlugin::AudioPlayerPlugin(QWidget *parent, QString ID) : LDPlugin(par this->layout()->setContentsMargins(0,0,0,0); this->layout()->addWidget(player); - this->setInitialSize(this->sizeHint().width(), this->sizeHint().height()); } AudioPlayerPlugin::~AudioPlayerPlugin(){ diff --git a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.h b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.h index eaa068ff..6aaeac4c 100644 --- a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.h +++ b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.h @@ -64,6 +64,11 @@ public: AudioPlayerPlugin(QWidget* parent, QString ID); ~AudioPlayerPlugin(); + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(3,1); + } + private: PlayerWidget *player; diff --git a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h index 133a3af6..b3a6a8d7 100644 --- a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h +++ b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h @@ -28,7 +28,6 @@ public: cal = new QCalendarWidget(this); cal->setSelectionMode(QCalendarWidget::NoSelection); this->layout()->addWidget(cal); - this->setInitialSize( cal->sizeHint().width(), cal->sizeHint().height() ); timer = new QTimer(this); timer->setInterval(1800000); //30 minute refresh timer timer->start(); @@ -38,6 +37,11 @@ public: ~CalendarPlugin(){ timer->stop(); } + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(3,2); + } + private slots: void updateDate(){ if(cal->selectedDate() != QDate::currentDate()){ diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp index 0b48a049..d81afd1e 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp @@ -39,7 +39,6 @@ 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(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/desktopview/DesktopViewPlugin.h b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h index a75372a1..046b6e5c 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h @@ -23,6 +23,10 @@ public: DesktopViewPlugin(QWidget* parent, QString ID); ~DesktopViewPlugin(); + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(3,3); + } private: QListWidget *list; QMenu *menu; diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp index f66cb53e..e229774d 100644 --- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp +++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp @@ -62,9 +62,6 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID) QTimer::singleShot(2000, this, SLOT(notesDirChanged())); //qDebug() << "Set Sizing"; - //Now setup the initial values for the plugin - 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/notepad/NotepadPlugin.h b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h index a1d9bf8f..5a9ea2be 100644 --- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h +++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h @@ -23,6 +23,10 @@ public: NotePadPlugin(QWidget* parent, QString ID); ~NotePadPlugin(); + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(3,3); + } private: QPlainTextEdit *edit; QToolButton *open, *add, *rem; diff --git a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h index 0e6cda2f..4ba74133 100644 --- a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h +++ b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h @@ -27,11 +27,15 @@ public: this->layout()->addWidget(container); container->setSource(QUrl::fromLocalFile( LUtils::findQuickPluginFile(ID.section("---",0,0)) )); QApplication::processEvents(); //to check for errors right away - this->setInitialSize(container->initialSize().width(), container->initialSize().height()); + //this->setInitialSize(container->initialSize().width(), container->initialSize().height()); } ~QuickDPlugin(){} + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(2,2); + } private: QQuickWidget *container; diff --git a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp index 6a300b6c..951bcc98 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->sizeHint().width(),monitor->sizeHint().height()); + //this->setInitialSize(monitor->sizeHint().width(),monitor->sizeHint().height()); } SysMonitorPlugin::~SysMonitorPlugin(){ diff --git a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h index 08e8c09c..015ba7fe 100644 --- a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h +++ b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.h @@ -42,6 +42,11 @@ public: SysMonitorPlugin(QWidget* parent, QString ID); ~SysMonitorPlugin(); + virtual QSize defaultPluginSize(){ + // The returned QSize is in grid points (typically 100 or 200 pixels square) + return QSize(2,3); + } + private: MonitorWidget *monitor; |