diff options
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins')
28 files changed, 0 insertions, 3761 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/LDPlugin.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/LDPlugin.cpp deleted file mode 100644 index 545ba430..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/LDPlugin.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#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(); - //SPECIAL CONTEXT MENU OPTIONS FOR PARTICULAR PLUGIN TYPES - if(PLUGID.startsWith("applauncher::")){ - menu->addAction( LXDG::findIcon("quickopen",""), tr("Launch Item"), this, SIGNAL(PluginActivated()) ); - menu->addSeparator(); - } - //General Options - 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("zoom-in",""), tr("Increase Item Sizes"), this, SIGNAL(IncreaseIconSize()) ); - menu->addAction( LXDG::findIcon("zoom-out",""), tr("Decrease Item Sizes"), this, SIGNAL(DecreaseIconSize()) ); - menu->addSeparator(); - menu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove Item"), this, SLOT(slotRemovePlugin()) ); -} - -/*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()){ - //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(); - } - //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()); -}*/ diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/LDPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/LDPlugin.h deleted file mode 100644 index 820880ed..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/LDPlugin.h +++ /dev/null @@ -1,156 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is the generic container layout for all desktop plugins -// Simply subclass this when creating a new plugin to enable correct -// visibility and usage within the desktop window -//=========================================== -// WARNING: Do *not* setup a custom context menu for the entire plugins area! -// This can prevent access to the general desktop context menu if -// the plugin was maximized to fill the desktop area! -//=========================================== -#ifndef _LUMINA_DESKTOP_DESKTOP_PLUGIN_H -#define _LUMINA_DESKTOP_DESKTOP_PLUGIN_H - -#include <QObject> -#include <QFrame> -#include <QWidget> -#include <QString> -#include <QDebug> -#include <QSettings> -#include <QMoveEvent> -#include <QResizeEvent> -#include <QMouseEvent> -#include <QTimer> -#include <QMenu> - -class LDPlugin : public QFrame{ - Q_OBJECT - -private: - QString PLUGID, prefix; - QSettings *settings; - QMenu *menu; - QTimer *dragTimer; - - void setupMenu(); - -public: - LDPlugin(QWidget *parent = 0, QString id="unknown"); - - ~LDPlugin(){} - - QString ID(){ - return PLUGID; - } - - 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); - settings->sync(); - } - - QRect loadPluginGeometry(){ - return settings->value(prefix+"geometry/desktopGridPoints", QRect()).toRect(); - } - - void saveSetting(QString var, QVariant val){ - //qDebug() << "Saving Setting:" << prefix+var+QString(" = ")+val.toString(); - settings->setValue(prefix+var, val); - settings->sync(); - } - - QVariant readSetting(QString var, QVariant defaultval){ - return settings->value(prefix+var, defaultval); - } - - virtual void Cleanup(){ - //This needs to be re-implemented in the subclassed plugin - //This is where any last-minute changes are performed before a plugin is removed permanently - //Note1: This is *not* called if the plugin is being temporarily closed - //Note2: All the settings for this plugin will be automatically removed after this is finished - } - - void removeSettings(bool permanent = false){ //such as when a plugin is deleted - if(permanent){ Cleanup(); } - QStringList list = settings->allKeys().filter(prefix); - for(int i=0; i<list.length(); i++){ settings->remove(list[i]); } - - } - -public slots: - virtual void LocaleChange(){ - //This needs to be re-implemented in the subclassed plugin - //This is where all text is set/translated - setupMenu(); - } - virtual void ThemeChange(){ - //This needs to be re-implemented in the subclassed plugin - //This is where all the visuals are set if using Theme-dependant icons. - setupMenu(); - } - void showPluginMenu(){ - emit CloseDesktopMenu(); - menu->popup( QCursor::pos() ); - } - -signals: - void OpenDesktopMenu(); - void CloseDesktopMenu(); - void PluginResized(); - void PluginActivated(); - - //Signals for communication with the desktop layout system (not generally used by hand) - void StartMoving(QString); //ID of plugin - void StartResizing(QString); //ID of plugin - void RemovePlugin(QString); //ID of plugin - void IncreaseIconSize(); // only used for desktop icons - void DecreaseIconSize(); // only used for desktop icons - -private slots: - void slotStartMove(){ - QCursor::setPos( this->mapToGlobal(QPoint(this->width()/2, this->height()/2)) ); - emit StartMoving(PLUGID); - } - - void slotStartResize(){ - QCursor::setPos( this->mapToGlobal(QPoint(this->width()/2, this->height()/2)) ); - emit StartResizing(PLUGID); - } - - void slotRemovePlugin(){ - removeSettings(true); - emit RemovePlugin(PLUGID); - } - -protected: - void mousePressEvent(QMouseEvent *ev){ - if(!dragTimer->isActive() && ev->buttons().testFlag(Qt::LeftButton) ){ dragTimer->start(); } - QWidget::mousePressEvent(ev); - } - void mouseReleaseEvent(QMouseEvent *ev){ - if(dragTimer->isActive()){ dragTimer->stop(); } - QWidget::mouseReleaseEvent(ev); - } - void mouseMoveEvent(QMouseEvent *ev){ - if(ev->buttons().testFlag(Qt::LeftButton)){ - if(dragTimer->isActive()){ dragTimer->stop(); } - slotStartMove(); - } - QWidget::mouseMoveEvent(ev); - } - void resizeEvent(QResizeEvent *ev){ - emit PluginResized(); - QFrame::resizeEvent(ev); //do normal processing - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/NewDP.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/NewDP.h deleted file mode 100644 index e28b8c61..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/NewDP.h +++ /dev/null @@ -1,63 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is the interface to load all the different desktop plugins -//=========================================== -#ifndef _LUMINA_DESKTOP_NEW_DESKTOP_PLUGIN_H -#define _LUMINA_DESKTOP_NEW_DESKTOP_PLUGIN_H - -#include <QDebug> - -//List all the individual plugin includes here -#include "LDPlugin.h" -//#include "SamplePlugin.h" -#include "calendar/CalendarPlugin.h" -#include "applauncher/AppLauncherPlugin.h" -#include "desktopview/DesktopViewPlugin.h" -#include "notepad/NotepadPlugin.h" -#include "audioplayer/PlayerWidget.h" -#include "systemmonitor/MonitorWidget.h" -//#include "quickcontainer/QuickDPlugin.h" -//#include "messagecenter/MessageCenter.h" -#include "rssreader/RSSFeedPlugin.h" - -class NewDP{ -public: - static LDPlugin* createPlugin(QString plugin, QWidget* parent=0){ - //qDebug() << "Create Plugin:" << plugin; - LDPlugin *plug = 0; - /*if(plugin.section("---",0,0)=="sample"){ - plug = new SamplePlugin(parent, plugin); - }else */ - if(plugin.section("---",0,0)=="calendar"){ - plug = new CalendarPlugin(parent, plugin); - }else if(plugin.section("---",0,0).section("::",0,0)=="applauncher"){ - //This plugin can be pre-initialized to a file path after the "::" delimiter - plug = new AppLauncherPlugin(parent, plugin); - }else if(plugin.section("---",0,0)=="desktopview"){ - plug = new DesktopViewPlugin(parent, plugin); - }else if(plugin.section("---",0,0)=="notepad"){ - plug = new NotePadPlugin(parent, plugin); - }else if(plugin.section("---",0,0)=="audioplayer"){ - plug = new AudioPlayerPlugin(parent, plugin); - }else if(plugin.section("---",0,0)=="systemmonitor"){ - plug = new SysMonitorPlugin(parent, plugin); - //}else if(plugin.section("---",0,0)=="messagecenter"){ - //plug = new MessageCenterPlugin(parent, plugin); - //}else if(plugin.section("---",0,0).startsWith("quick-") && LUtils::validQuickPlugin(plugin.section("---",0,0)) ){ - //plug = new QuickDPlugin(parent, plugin); - }else if(plugin.section("---",0,0)=="rssreader"){ - plug = new RSSFeedPlugin(parent, plugin); - }else{ - qWarning() << "Invalid Desktop Plugin:"<<plugin << " -- Ignored"; - } - //qDebug() << " -- done"; - return plug; - } - -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/SamplePlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/SamplePlugin.h deleted file mode 100644 index 4a790c2d..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/SamplePlugin.h +++ /dev/null @@ -1,38 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is a quick sample desktop plugin -//=========================================== -#ifndef _LUMINA_DESKTOP_DESKTOP_PLUGIN_SAMPLE_H -#define _LUMINA_DESKTOP_DESKTOP_PLUGIN_SAMPLE_H - -#include <QPushButton> -#include <QMessageBox> -#include <QVBoxLayout> -#include "LDPlugin.h" - -class SamplePlugin : public LDPlugin{ - Q_OBJECT -public: - SamplePlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ - this->setLayout( new QVBoxLayout()); - this->layout()->setContentsMargins(0,0,0,0); - button = new QPushButton("sample"); - this->layout()->addWidget(button); - connect(button, SIGNAL(clicked()), this, SLOT(showMessage()) ); - } - - ~SamplePlugin(){} - -private: - QPushButton *button; - -private slots: - void showMessage(){ - QMessageBox::information(this,"sample","sample desktop plugin works"); - } -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/AppLauncherPlugin.cpp deleted file mode 100644 index 3be19faa..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include "AppLauncherPlugin.h" -#include "../../LSession.h" -#include "OutlineToolButton.h" - -#define OUTMARGIN 10 //special margin for fonts due to the outlining effect from the OutlineToolbutton - -AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ - QVBoxLayout *lay = new QVBoxLayout(); - this->setLayout(lay); - lay->setContentsMargins(0,0,0,0); - button = new OutlineToolButton(this); - button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); - button->setAutoRaise(true); - button->setText("...\n..."); //Need to set something here so that initial sizing works properly - button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); - lay->addWidget(button, 0, Qt::AlignCenter); - connect(button, SIGNAL(DoubleClicked()), this, SLOT(buttonClicked()) ); - button->setContextMenuPolicy(Qt::NoContextMenu); - watcher = new QFileSystemWatcher(this); - connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) ); - - connect(this, SIGNAL(PluginActivated()), this, SLOT(buttonClicked()) ); //in case they use the context menu to launch it. - loadButton(); - //QTimer::singleShot(0,this, SLOT(loadButton()) ); -} - -void AppLauncherPlugin::Cleanup(){ - //This is run only when the plugin was forcibly closed/removed - -} - -void AppLauncherPlugin::loadButton(){ - QString def = this->ID().section("::",1,50).section("---",0,0).simplified(); - QString path = this->readSetting("applicationpath",def).toString(); //use the default if necessary - //qDebug() << "Default Application Launcher:" << def << path; - bool ok = QFile::exists(path); - if(!ok){ emit RemovePlugin(this->ID()); return;} - 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; - if(path.endsWith(".desktop") && ok){ - XDGDesktop file(path); - ok = !file.name.isEmpty(); - if(!ok){ - button->setWhatsThis(""); - button->setIcon( QIcon(LXDG::findIcon("quickopen-file","").pixmap(QSize(icosize,icosize)).scaledToHeight(icosize, Qt::SmoothTransformation) ) ); - txt = tr("Click to Set"); - if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); } - }else{ - button->setWhatsThis(file.filePath); - button->setIcon( QIcon(LXDG::findIcon(file.icon,"system-run").pixmap(QSize(icosize,icosize)).scaledToHeight(icosize, Qt::SmoothTransformation) ) ); - txt = file.name; - if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); } - watcher->addPath(file.filePath); //make sure to update this shortcut if the file changes - } - }else if(ok){ - QFileInfo info(path); - button->setWhatsThis(info.absoluteFilePath()); - if(info.isDir()){ - button->setIcon( LXDG::findIcon("folder","") ); - }else if(LUtils::imageExtensions().contains(info.suffix().toLower()) ){ - QPixmap pix; - if(pix.load(path)){ button->setIcon( QIcon(pix.scaled(256,256)) ); } //max size for thumbnails in memory - else{ button->setIcon( LXDG::findIcon("dialog-cancel","") ); } - }else{ - button->setIcon( QIcon(LXDG::findMimeIcon(path).pixmap(QSize(icosize,icosize)).scaledToHeight(icosize, Qt::SmoothTransformation) ) ); - } - txt = info.fileName(); - if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); } - watcher->addPath(path); //make sure to update this shortcut if the file changes - }else{ - //InValid File - button->setWhatsThis(""); - button->setIcon( QIcon(LXDG::findIcon("quickopen","dialog-cancel").pixmap(QSize(icosize,icosize)).scaledToHeight(icosize, Qt::SmoothTransformation) ) ); - button->setText( tr("Click to Set") ); - if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); } - } - //If the file is a symlink, put the overlay on the icon - if(QFileInfo(path).isSymLink()){ - QImage img = button->icon().pixmap(QSize(icosize,icosize)).toImage(); - int oSize = icosize/3; //overlay size - QPixmap overlay = LXDG::findIcon("emblem-symbolic-link").pixmap(oSize,oSize).scaled(oSize,oSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); - QPainter painter(&img); - painter.drawPixmap(icosize-oSize,icosize-oSize,overlay); //put it in the bottom-right corner - button->setIcon( QIcon(QPixmap::fromImage(img)) ); - } - //Now adjust the visible text as necessary based on font/grid sizing - button->setToolTip(txt); - //Double check that the visual icon size matches the requested size - otherwise upscale the icon - if(button->fontMetrics().width(txt) > (button->width()-OUTMARGIN) ){ - //Text too long, try to show it on two lines - //txt = button->fontMetrics().elidedText(txt, Qt::ElideRight, 2*(button->width()-OUTMARGIN), Qt::TextWordWrap); - txt =txt.section(" ",0,2).replace(" ","\n"); //First take care of any natural breaks - //Go through and combine any lines - if(txt.contains("\n")){ - //need to check each line - QStringList txtL = txt.split("\n"); - for(int i=0; i<txtL.length(); i++){ - if(( i+1<txtL.length()) && (button->fontMetrics().width(txtL[i]) < button->width()/2) ){ - txtL[i] = txtL[i]+" "+txtL[i+1]; - txtL.removeAt(i+1); - } - } - txt = txtL.join("\n").section("\n",0,2); - } - - if(txt.contains("\n")){ - //need to check each line - QStringList txtL = txt.split("\n"); - for(int i=0; i<txtL.length(); i++){ - if(i>1){ txtL.removeAt(i); i--; } //Only take the first two lines - else{ txtL[i] = button->fontMetrics().elidedText(txtL[i], Qt::ElideRight, (button->width()-OUTMARGIN) ); } - } - txt = txtL.join("\n"); - }else{ - txt = this->fontMetrics().elidedText(txt,Qt::ElideRight, 2*(button->width()-OUTMARGIN)); - //Now split the line in half for the two lines - 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); - - QTimer::singleShot(100, this, SLOT(update()) ); //Make sure to re-draw the image in a moment -} - -void AppLauncherPlugin::buttonClicked(){ - QString path = button->whatsThis(); - if(path.isEmpty() || !QFile::exists(path) ){ - //prompt for the user to select an application - QList<XDGDesktop*> apps = LSession::handle()->applicationMenu()->currentAppHash()->value("All"); //LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ); - QStringList names; - for(int i=0; i<apps.length(); i++){ names << apps[i]->name; } - bool ok = false; - QString app = QInputDialog::getItem(this, tr("Select Application"), tr("Name:"), names, 0, false, &ok); - if(!ok || names.indexOf(app)<0){ return; } //cancelled - this->saveSetting("applicationpath", apps[ names.indexOf(app) ]->filePath); - QTimer::singleShot(0,this, SLOT(loadButton())); - }else{ - LSession::LaunchApplication("lumina-open \""+path+"\""); - } - -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/AppLauncherPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/AppLauncherPlugin.h deleted file mode 100644 index a0f6a7cd..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/AppLauncherPlugin.h +++ /dev/null @@ -1,59 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is a quick sample desktop plugin -//=========================================== -#ifndef _LUMINA_DESKTOP_DESKTOP_PLUGIN_APPLICATION_LAUNCHER_H -#define _LUMINA_DESKTOP_DESKTOP_PLUGIN_APPLICATION_LAUNCHER_H - -#include <QToolButton> -#include <QInputDialog> -#include <QVBoxLayout> -#include <QProcess> -#include <QFile> -#include <QFileSystemWatcher> -#include <QTimer> -#include <QMenu> -#include <QCursor> - -#include "../LDPlugin.h" - -#include <LuminaXDG.h> - -class AppLauncherPlugin : public LDPlugin{ - Q_OBJECT -public: - AppLauncherPlugin(QWidget* parent, QString ID); - ~AppLauncherPlugin(){} - - void Cleanup(); //special function for final cleanup - -private: - QToolButton *button; - QFileSystemWatcher *watcher; - //QMenu *menu; - -private slots: - void loadButton(); - void buttonClicked(); - //void openContextMenu(); - - //void increaseIconSize(); - //void decreaseIconSize(); - //void deleteFile(); - -public slots: - void LocaleChange(){ - loadButton(); //force reload - } - -protected: - void resizeEvent(QResizeEvent *ev){ - LDPlugin::resizeEvent(ev); - QTimer::singleShot(100, this, SLOT(loadButton()) ); - } -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/OutlineToolButton.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/OutlineToolButton.h deleted file mode 100644 index 24410e75..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/applauncher/OutlineToolButton.h +++ /dev/null @@ -1,99 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This is a simple subclass for a QToolButton with black/white text (for transparent backgrounds) -//=========================================== -#ifndef _LUMINA_DESKTOP_PLUGIN_APPLAUNCHER_OUTLINE_TOOLBUTTON_H -#define _LUMINA_DESKTOP_PLUGIN_APPLAUNCHER_OUTLINE_TOOLBUTTON_H - -#include <QToolButton> -#include <QPainter> -#include <QPainterPath> -#include <QPen> -#include <QStyle> -#include <QStyleOption> -#include <QStylePainter> -#include <QFont> -#include <QDebug> -#include <QMouseEvent> - - -class OutlineToolButton : public QToolButton{ - Q_OBJECT -public: - OutlineToolButton(QWidget *parent=0) : QToolButton(parent){ - //This button needs slightly different font settings - do this in the constructor so that other widgets can take it into account. - QFont font = this->font(); - font.setStyleStrategy(QFont::PreferAntialias); //Always set the font strategy (just in case it starts working down the road) - this->setFont(font); - this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - } - ~OutlineToolButton(){} - -signals: - void DoubleClicked(); - -protected: - void mouseDoubleClickEvent(QMouseEvent *ev){ - ev->accept(); - emit DoubleClicked(); - } - void mousePressEvent(QMouseEvent *ev){ - ev->ignore(); - } - void mouseReleaseEvent(QMouseEvent *ev){ - ev->ignore(); - } - - void paintEvent(QPaintEvent*){ - /* NOTE: This is what a standard QToolButton performs (peeked at Qt source code for this tidbit) - QStylePainter p(this); - QStyleOptionToolButton opt; - initStyleOption(&opt); - p.drawComplexControl(QStyle::CC_ToolButton, opt); - */ - - //Modify the standard QToolButton routine to paint the text differently - QStylePainter p(this); - QStyleOptionToolButton opt; - initStyleOption(&opt); - opt.font = this->property("font").value<QFont>(); //This ensures that the stylesheet values are incorporated - opt.font.setStyleStrategy(QFont::PreferAntialias); //Always set the font strategy (just in case it starts working down the road) - opt.font.setKerning(true); - opt.fontMetrics = QFontMetrics(opt.font); - opt.text.clear(); //Don't paint the text yet - just the background/icon - p.drawComplexControl(QStyle::CC_ToolButton, opt); //This does all the normal QToolButton stuff - just not text - //Now get the text rectangle for the widget - QRect box = p.style()->itemTextRect(opt.fontMetrics, opt.rect, Qt::AlignHCenter | Qt::AlignBottom, true, this->text()); - //Get the QColors for the outline/text - QColor textC = opt.palette.text().color().toHsl(); //need the lightness value in a moment - QColor outC = textC; - //qDebug() << "Font Color Values:" << textC << textC.lightness() << textC.lightnessF(); - if(textC.lightnessF() > 0.5){ outC.setHsl(textC.hue(), textC.hslSaturation(), 0, 90); } - else{outC.setHsl(textC.hue(), textC.hslSaturation(), 255, 50); } - //qDebug() << "Outline Color Values:" << outC; - //Now get the size of the outline border (need to scale for high-res monitors) - qreal OWidth = opt.fontMetrics.width("o")/2.0; - //qDebug() << "Outline Width:" << OWidth; - //Now generate a QPainterPath for the text - QPainterPath path; - QStringList txt = this->text().split("\n"); //need each line independently, the newline actually gets painted otherwise - for(int i=0; i<txt.length(); i++){ - path.addText(box.center().x() - (opt.fontMetrics.width(txt[i])/2), box.y()+((i+1)*(box.height()/txt.length()))-opt.fontMetrics.descent(), opt.font, txt[i] ); - } - path.setFillRule(Qt::WindingFill); - //Now paint the text - QRadialGradient RG(box.center(), box.width()*1.5); //width is always going to be greater than height - RG.setColorAt(0, outC); - RG.setColorAt(1, Qt::transparent); - p.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); //need antialiasing for this to work well (sub-pixel painting) - p.strokePath(path, QPen(QBrush(RG),OWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin) ); //This will be the outline - 1pixel thick, semi-transparent - p.fillPath(path, QBrush(textC)); //this will be the inside/text color - - } - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.cpp deleted file mode 100644 index 722a5865..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.cpp +++ /dev/null @@ -1,271 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "PlayerWidget.h" -#include "ui_PlayerWidget.h" - -#include <QDir> -#include <QUrl> -#include <QInputDialog> -#include <QFileDialog> -#include <LuminaXDG.h> -#include <QDebug> -#include <QDesktopWidget> - -PlayerWidget::PlayerWidget(QWidget *parent) : QWidget(parent), ui(new Ui::PlayerWidget()){ - ui->setupUi(this); //load the designer form - PLAYER = new QMediaPlayer(this); - PLAYER->setVolume(100); - PLAYER->setNotifyInterval(1000); //1 second interval (just needs to be a rough estimate) - PLAYLIST = new QMediaPlaylist(this); - PLAYLIST->setPlaybackMode(QMediaPlaylist::Sequential); - PLAYER->setPlaylist(PLAYLIST); - - configMenu = new QMenu(this); - ui->tool_config->setMenu(configMenu); - addMenu = new QMenu(this); - ui->tool_add->setMenu(addMenu); - - updatinglists = false; //start off as false - - ui->combo_playlist->setContextMenuPolicy(Qt::NoContextMenu); - - LoadIcons(); - playerStateChanged(); //update button visibility - currentSongChanged(); - //Connect all the signals/slots - //connect(infoTimer, SIGNAL(timeout()), this, SLOT(rotateTrackInfo()) ); - connect(PLAYER, SIGNAL(positionChanged(qint64)),this, SLOT(updateProgress(qint64)) ); - connect(PLAYER, SIGNAL(durationChanged(qint64)), this, SLOT(updateMaxProgress(qint64)) ); - connect(PLAYLIST, SIGNAL(mediaChanged(int, int)), this, SLOT(playlistChanged()) ); - connect(PLAYER, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged()) ); - connect(PLAYLIST, SIGNAL(currentMediaChanged(const QMediaContent&)), this, SLOT(currentSongChanged()) ); - connect(ui->combo_playlist, SIGNAL(currentIndexChanged(int)), this, SLOT(userlistSelectionChanged()) ); - connect(ui->tool_play, SIGNAL(clicked()), this, SLOT(playClicked()) ); - connect(ui->tool_pause, SIGNAL(clicked()), this, SLOT(pauseClicked()) ); - connect(ui->tool_stop, SIGNAL(clicked()), this, SLOT(stopClicked()) ); - connect(ui->tool_next, SIGNAL(clicked()), this, SLOT(nextClicked()) ); - connect(ui->tool_prev, SIGNAL(clicked()), this, SLOT(prevClicked()) ); - -} - -PlayerWidget::~PlayerWidget(){ - //qDebug() << "Removing PlayerWidget"; -} - -void PlayerWidget::LoadIcons(){ - ui->tool_stop->setIcon( LXDG::findIcon("media-playback-stop","") ); - ui->tool_play->setIcon( LXDG::findIcon("media-playback-start","") ); - ui->tool_pause->setIcon( LXDG::findIcon("media-playback-pause","") ); - ui->tool_next->setIcon( LXDG::findIcon("media-skip-forward","") ); - ui->tool_prev->setIcon( LXDG::findIcon("media-skip-backward","") ); - ui->tool_add->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_config->setIcon( LXDG::findIcon("configure","") ); - //Now re-assemble the menus as well - configMenu->clear(); - configMenu->addAction(LXDG::findIcon("media-eject",""), tr("Clear Playlist"), this, SLOT(ClearPlaylist())); - configMenu->addAction(LXDG::findIcon("roll",""), tr("Shuffle Playlist"), this, SLOT(ShufflePlaylist())); - addMenu->clear(); - addMenu->addAction(LXDG::findIcon("document-new",""), tr("Add Files"), this, SLOT(AddFilesToPlaylist())); - addMenu->addAction(LXDG::findIcon("folder-new",""), tr("Add Directory"), this, SLOT(AddDirToPlaylist())); - addMenu->addAction(LXDG::findIcon("download",""), tr("Add URL"), this, SLOT(AddURLToPlaylist())); -} - -void PlayerWidget::playClicked(){ - PLAYER->play(); -} - -void PlayerWidget::pauseClicked(){ - PLAYER->pause(); -} - -void PlayerWidget::stopClicked(){ - PLAYER->stop(); -} - -void PlayerWidget::nextClicked(){ - PLAYLIST->next(); -} - -void PlayerWidget::prevClicked(){ - PLAYLIST->previous(); -} - -void PlayerWidget::AddFilesToPlaylist(){ - //Prompt the user to select multimedia files - QFileDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint ); - dlg.setFileMode(QFileDialog::ExistingFiles); - dlg.setAcceptMode(QFileDialog::AcceptOpen); - dlg.setNameFilter( tr("Multimedia Files")+" ("+LXDG::findAVFileExtensions().join(" ")+")"); - dlg.setWindowTitle(tr("Select Multimedia Files")); - dlg.setWindowIcon( LXDG::findIcon("file-open","") ); - dlg.setDirectory(QDir::homePath()); //start in the home directory - //ensure it is centered on the current screen - QPoint center = QApplication::desktop()->screenGeometry(this).center(); - dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) ); - dlg.show(); - while( dlg.isVisible() ){ - QApplication::processEvents(); - } - QList<QUrl> files = dlg.selectedUrls(); - if(files.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled - //Make this use show/processEvents later - //QList<QUrl> files = QFileDialog::getOpenFileUrls(0, tr("Select Multimedia Files"), QDir::homePath(), "Multimedia Files ("+LXDG::findAVFileExtensions().join(" ")+")"); - QList<QMediaContent> urls; - for(int i=0; i<files.length(); i++){ - urls << QMediaContent(files[i]); - } - PLAYLIST->addMedia(urls); - playlistChanged(); -} - -void PlayerWidget::AddDirToPlaylist(){ - QFileDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint ); - dlg.setFileMode(QFileDialog::Directory); - dlg.setOption(QFileDialog::ShowDirsOnly, true); - dlg.setAcceptMode(QFileDialog::AcceptOpen); - dlg.setWindowTitle(tr("Select Multimedia Directory")); - dlg.setWindowIcon( LXDG::findIcon("folder-open","") ); - dlg.setDirectory(QDir::homePath()); //start in the home directory - //ensure it is centered on the current screen - QPoint center = QApplication::desktop()->screenGeometry(this).center(); - dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) ); - dlg.show(); - while( dlg.isVisible() ){ - QApplication::processEvents(); - } - if(dlg.result() != QDialog::Accepted){ return; } //cancelled - QStringList sel = dlg.selectedFiles(); - if(sel.isEmpty()){ return; } //cancelled - QString dirpath = sel.first(); //QFileDialog::getExistingDirectory(0, tr("Select a Multimedia Directory"), QDir::homePath() ); - if(dirpath.isEmpty()){ return; } //cancelled - QDir dir(dirpath); - QFileInfoList files = dir.entryInfoList(LXDG::findAVFileExtensions(), QDir::Files | QDir::NoDotAndDotDot, QDir::Name); - if(files.isEmpty()){ return; } //nothing in this directory - QList<QMediaContent> urls; - for(int i=0; i<files.length(); i++){ - urls << QMediaContent(QUrl::fromLocalFile(files[i].absoluteFilePath()) ); - } - PLAYLIST->addMedia(urls); - playlistChanged(); -} - -void PlayerWidget::AddURLToPlaylist(){ - QInputDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint ); - dlg.setInputMode(QInputDialog::TextInput); - dlg.setLabelText(tr("Enter a valid URL for a multimedia file or stream:")); - dlg.setTextEchoMode(QLineEdit::Normal); - dlg.setWindowTitle(tr("Multimedia URL")); - dlg.setWindowIcon( LXDG::findIcon("download","") ); - //ensure it is centered on the current screen - QPoint center = QApplication::desktop()->screenGeometry(this).center(); - dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) ); - dlg.show(); - while( dlg.isVisible() ){ - QApplication::processEvents(); - } - QString url = dlg.textValue(); - if(url.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled - - //QString url = QInputDialog::getText(0, tr("Multimedia URL"), tr("Enter a valid URL for a multimedia file or stream"), QLineEdit::Normal); - //if(url.isEmpty()){ return; } - QUrl newurl(url); - if(!newurl.isValid()){ return; } //invalid URL - PLAYLIST->addMedia(newurl); - playlistChanged(); -} - -void PlayerWidget::ClearPlaylist(){ - PLAYER->stop(); - PLAYLIST->clear(); - playlistChanged(); -} - -void PlayerWidget::ShufflePlaylist(){ - PLAYLIST->shuffle(); -} - - -void PlayerWidget::userlistSelectionChanged(){ //front-end combobox was changed by the user - if(updatinglists){ return; } - PLAYLIST->setCurrentIndex( ui->combo_playlist->currentIndex() ); -} - -void PlayerWidget::playerStateChanged(){ - switch( PLAYER->state() ){ - case QMediaPlayer::StoppedState: - ui->tool_stop->setVisible(false); - ui->tool_play->setVisible(true); - ui->tool_pause->setVisible(false); - ui->progressBar->setVisible(false); - break; - case QMediaPlayer::PausedState: - ui->tool_stop->setVisible(true); - ui->tool_play->setVisible(true); - ui->tool_pause->setVisible(false); - ui->progressBar->setVisible(true); - break; - case QMediaPlayer::PlayingState: - ui->tool_stop->setVisible(true); - ui->tool_play->setVisible(false); - ui->tool_pause->setVisible(true); - ui->progressBar->setVisible(true); - break; - } - -} - -void PlayerWidget::playlistChanged(){ - updatinglists = true; - ui->combo_playlist->clear(); - for(int i=0; i<PLAYLIST->mediaCount(); i++){ - QUrl url = PLAYLIST->media(i).canonicalUrl(); - if(url.isLocalFile()){ - ui->combo_playlist->addItem(LXDG::findMimeIcon(url.fileName().section(".",-1)), url.fileName() ); - }else{ - ui->combo_playlist->addItem(LXDG::findIcon("download",""), url.toString() ); - } - } - if(PLAYLIST->currentIndex()<0 && PLAYLIST->mediaCount()>0){ PLAYLIST->setCurrentIndex(0); } - ui->combo_playlist->setCurrentIndex(PLAYLIST->currentIndex()); - - updatinglists = false; -} - -void PlayerWidget::currentSongChanged(){ - if(PLAYLIST->currentIndex() != ui->combo_playlist->currentIndex()){ - updatinglists = true; - ui->combo_playlist->setCurrentIndex(PLAYLIST->currentIndex()); - updatinglists = false; - } - ui->tool_next->setEnabled( PLAYLIST->nextIndex() >= 0 ); - ui->tool_prev->setEnabled( PLAYLIST->previousIndex() >= 0); - ui->label_num->setText( QString::number( PLAYLIST->currentIndex()+1)+"/"+QString::number(PLAYLIST->mediaCount()) ); - ui->progressBar->setRange(0, PLAYER->duration() ); - ui->progressBar->setValue(0); -} - -void PlayerWidget::updateProgress(qint64 val){ - //qDebug() << "Update Progress Bar:" << val; - ui->progressBar->setValue(val); -} - -void PlayerWidget::updateMaxProgress(qint64 val){ - ui->progressBar->setRange(0,val); -} - - -AudioPlayerPlugin::AudioPlayerPlugin(QWidget *parent, QString ID) : LDPlugin(parent, ID){ - player = new PlayerWidget(this); - this->setLayout( new QVBoxLayout() ); - this->layout()->setContentsMargins(0,0,0,0); - this->layout()->addWidget(player); - -} - -AudioPlayerPlugin::~AudioPlayerPlugin(){ - //qDebug() << "Remove AudioPlayerPlugin"; -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.h deleted file mode 100644 index 6aaeac4c..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.h +++ /dev/null @@ -1,84 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This plugin is a simple audio player on the desktop -//=========================================== -#ifndef _LUMINA_DESKTOP_PLUGIN_AUDIO_PLAYER_WIDGET_H -#define _LUMINA_DESKTOP_PLUGIN_AUDIO_PLAYER_WIDGET_H - -#include <QMediaPlaylist> -#include <QMediaPlayer> -#include <QTimer> -#include <QWidget> -#include <QMenu> - -#include "../LDPlugin.h" - -namespace Ui{ - class PlayerWidget; -}; - -class PlayerWidget : public QWidget{ - Q_OBJECT -public: - PlayerWidget(QWidget *parent = 0); - ~PlayerWidget(); - -public slots: - void LoadIcons(); - -private: - Ui::PlayerWidget *ui; - QMediaPlaylist *PLAYLIST; - QMediaPlayer *PLAYER; - QMenu *configMenu, *addMenu; - bool updatinglists; - -private slots: - void playClicked(); - void pauseClicked(); - void stopClicked(); - void nextClicked(); - void prevClicked(); - - void AddFilesToPlaylist(); - void AddDirToPlaylist(); - void AddURLToPlaylist(); - void ClearPlaylist(); - void ShufflePlaylist(); - void userlistSelectionChanged(); //front-end combobox was changed by the user - void playerStateChanged(); - void playlistChanged(); //list of items changed - void currentSongChanged(); - void updateProgress(qint64 val); - void updateMaxProgress(qint64 val); -}; - -// Wrapper class to put this into a desktop plugin container -class AudioPlayerPlugin : public LDPlugin{ - Q_OBJECT -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; - -public slots: - void LocaleChange(){ - QTimer::singleShot(0,player, SLOT(LoadIcons())); - } - void ThemeChange(){ - QTimer::singleShot(0,player, SLOT(LoadIcons())); - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.ui b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.ui deleted file mode 100644 index b1e7ee59..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/audioplayer/PlayerWidget.ui +++ /dev/null @@ -1,182 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>PlayerWidget</class> - <widget class="QWidget" name="PlayerWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>346</width> - <height>81</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <property name="styleSheet"> - <string notr="true">QToolButton::menu-indicator{ image: none; }</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QToolButton" name="tool_config"> - <property name="text"> - <string notr="true">Config</string> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_add"> - <property name="text"> - <string notr="true">Add</string> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QToolButton" name="tool_prev"> - <property name="text"> - <string notr="true">prev</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_num"> - <property name="text"> - <string notr="true">1/10</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_next"> - <property name="text"> - <string notr="true">next</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QComboBox" name="combo_playlist"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QToolButton" name="tool_play"> - <property name="text"> - <string notr="true">Play</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_pause"> - <property name="text"> - <string notr="true">Pause</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_stop"> - <property name="text"> - <string notr="true">Stop</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QProgressBar" name="progressBar"> - <property name="value"> - <number>24</number> - </property> - <property name="textVisible"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/calendar/CalendarPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/calendar/CalendarPlugin.h deleted file mode 100644 index abb138f7..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/calendar/CalendarPlugin.h +++ /dev/null @@ -1,59 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is a quick sample desktop plugin -//=========================================== -#ifndef _LUMINA_DESKTOP_DESKTOP_PLUGIN_CALENDAR_H -#define _LUMINA_DESKTOP_DESKTOP_PLUGIN_CALENDAR_H - -#include <QCalendarWidget> -#include <QVBoxLayout> -#include <QDate> -#include <QTimer> -#include "../LDPlugin.h" - -class CalendarPlugin : public LDPlugin{ - Q_OBJECT -private: - QCalendarWidget *cal; - QTimer *timer; - -public: - CalendarPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ - this->setLayout( new QVBoxLayout()); - this->layout()->setContentsMargins(0,0,0,0); - cal = new QCalendarWidget(this); - cal->setSelectionMode(QCalendarWidget::NoSelection); - this->layout()->addWidget(cal); - timer = new QTimer(this); - timer->setInterval(1800000); //30 minute refresh timer - timer->start(); - connect(timer, SIGNAL(timeout()), this, SLOT(updateDate()) ); - QTimer::singleShot(0,this, SLOT(updateDate()) ); - connect(this, SIGNAL(PluginResized()), this, SLOT(UpdateCalendarSize())); - } - - ~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()){ - cal->setSelectedDate(QDate::currentDate()); - cal->showSelectedDate(); - } - } - void UpdateCalendarSize(){ - cal->setFixedSize(this->size()); - } - - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktop-plugins.pri b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktop-plugins.pri deleted file mode 100644 index 8376316a..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktop-plugins.pri +++ /dev/null @@ -1,24 +0,0 @@ -SOURCES += $$PWD/applauncher/AppLauncherPlugin.cpp \ - $$PWD/desktopview/DesktopViewPlugin.cpp \ - $$PWD/notepad/NotepadPlugin.cpp \ - $$PWD/audioplayer/PlayerWidget.cpp \ - $$PWD/systemmonitor/MonitorWidget.cpp \ - $$PWD/rssreader/RSSFeedPlugin.cpp \ - $$PWD/rssreader/RSSObjects.cpp -# $$PWD/messagecenter/MessageCenter.cpp - -HEADERS += $$PWD/calendar/CalendarPlugin.h \ - $$PWD/applauncher/AppLauncherPlugin.h \ - $$PWD/applauncher/OutlineToolButton.h \ - $$PWD/desktopview/DesktopViewPlugin.h \ - $$PWD/notepad/NotepadPlugin.h \ - $$PWD/audioplayer/PlayerWidget.h \ - $$PWD/systemmonitor/MonitorWidget.h \ - $$PWD/rssreader/RSSFeedPlugin.h \ - $$PWD/rssreader/RSSObjects.h -# $$PWD/quickcontainer/QuickDPlugin.h -# $$PWD/messagecenter/MessageCenter.h - -FORMS += $$PWD/audioplayer/PlayerWidget.ui \ - $$PWD/systemmonitor/MonitorWidget.ui \ - $$PWD/rssreader/RSSFeedPlugin.ui diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktopview/DesktopViewPlugin.cpp deleted file mode 100644 index 90f3374b..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktopview/DesktopViewPlugin.cpp +++ /dev/null @@ -1,214 +0,0 @@ -#include "DesktopViewPlugin.h" - -#include <QFileInfo> -#include <QDir> -#include <QClipboard> -#include <QMimeData> -#include <QImageReader> - -#include <LuminaXDG.h> -#include "LSession.h" - - -DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ - this->setLayout( new QVBoxLayout()); - this->layout()->setContentsMargins(0,0,0,0); - - list = new QListWidget(this); - list->setViewMode(QListView::IconMode); - list->setFlow(QListWidget::TopToBottom); //Qt bug workaround - need the opposite flow in the widget constructor - list->setWrapping(true); - list->setSpacing(4); - list->setSelectionBehavior(QAbstractItemView::SelectItems); - list->setSelectionMode(QAbstractItemView::ExtendedSelection); - list->setContextMenuPolicy(Qt::CustomContextMenu); - list->setMovement(QListView::Snap); //make sure items are "stuck" in the grid - - menu = new QMenu(this); - menu->addAction( LXDG::findIcon("run-build-file",""), tr("Open"), this, SLOT(runItems()) ); - menu->addSeparator(); - menu->addAction( LXDG::findIcon("edit-cut",""), tr("Cut"), this, SLOT(cutItems()) ); - menu->addAction( LXDG::findIcon("edit-copy",""), tr("Copy"), this, SLOT(copyItems()) ); - menu->addSeparator(); - menu->addAction( LXDG::findIcon("zoom-in",""), tr("Increase Icons"), this, SLOT(increaseIconSize()) ); - menu->addAction( LXDG::findIcon("zoom-out",""), tr("Decrease Icons"), this, SLOT(decreaseIconSize()) ); - menu->addSeparator(); - menu->addAction( LXDG::findIcon("edit-delete",""), tr("Delete"), this, SLOT(deleteItems()) ); - menu->addSeparator(); - if(LUtils::isValidBinary("lumina-fileinfo")){ - menu->addAction( LXDG::findIcon("system-search",""), tr("Properties"), this, SLOT(displayProperties()) ); - } - this->layout()->addWidget(list); - - 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(1000,this, SLOT(updateContents()) ); //wait a second before loading contents -} - -DesktopViewPlugin::~DesktopViewPlugin(){ - -} - -void DesktopViewPlugin::runItems(){ - QList<QListWidgetItem*> sel = list->selectedItems(); - for(int i=0; i<sel.length(); i++){ - LSession::LaunchApplication("lumina-open \""+sel[i]->whatsThis()+"\""); - } -} - -void DesktopViewPlugin::copyItems(){ - QList<QListWidgetItem*> sel = list->selectedItems(); - if(sel.isEmpty()){ return; } //nothing selected - QStringList items; - //Format the data string - for(int i=0; i<sel.length(); i++){ - items << "copy::::"+sel[i]->whatsThis(); - } - //Now save that data to the global clipboard - QMimeData *dat = new QMimeData; - dat->clear(); - dat->setData("x-special/lumina-copied-files", items.join("\n").toLocal8Bit()); - QApplication::clipboard()->clear(); - QApplication::clipboard()->setMimeData(dat); -} - -void DesktopViewPlugin::cutItems(){ - QList<QListWidgetItem*> sel = list->selectedItems(); - if(sel.isEmpty()){ return; } //nothing selected - QStringList items; - //Format the data string - for(int i=0; i<sel.length(); i++){ - items << "cut::::"+sel[i]->whatsThis(); - } - //Now save that data to the global clipboard - QMimeData *dat = new QMimeData; - dat->clear(); - dat->setData("x-special/lumina-copied-files", items.join("\n").toLocal8Bit()); - QApplication::clipboard()->clear(); - QApplication::clipboard()->setMimeData(dat); -} - -void DesktopViewPlugin::deleteItems(){ - QList<QListWidgetItem*> sel = list->selectedItems(); - for(int i=0; i<sel.length(); i++){ - if(QFileInfo(sel[i]->whatsThis()).isDir()){ - QProcess::startDetached("rm -r \""+sel[i]->whatsThis()+"\""); - }else{ - QFile::remove(sel[i]->whatsThis()); - } - } -} - -void DesktopViewPlugin::showMenu(const QPoint &pos){ - //Make sure there is an item underneath the mouse first - if(list->itemAt(pos)!=0){ - menu->popup(this->mapToGlobal(pos)); - }else{ - //Pass the context menu request on to the desktop (emit it from the plugin) - this->showPluginMenu(); - //emit OpenDesktopMenu(); - } -} - -void DesktopViewPlugin::increaseIconSize(){ - int icosize = this->readSetting("IconSize",64).toInt(); - icosize+=16; //go in orders of 16 pixels - //list->setIconSize(QSize(icosize,icosize)); - this->saveSetting("IconSize",icosize); - QTimer::singleShot(10, this, SLOT(updateContents())); -} - -void DesktopViewPlugin::decreaseIconSize(){ - int icosize = this->readSetting("IconSize",64).toInt(); - if(icosize < 20){ return; } //too small to decrease more - icosize-=16; //go in orders of 16 pixels - //list->setIconSize(QSize(icosize,icosize)); - this->saveSetting("IconSize",icosize); - QTimer::singleShot(10,this, SLOT(updateContents())); -} - -void DesktopViewPlugin::updateContents(){ - list->clear(); - - int icosize = this->readSetting("IconSize",64).toInt(); - QSize gridSZ = QSize(qRound(1.8*icosize),icosize+4+(2*this->fontMetrics().height()) ); - //qDebug() << "Icon Size:" << icosize <<"Grid Size:" << gridSZ.width() << gridSZ.height(); - list->setGridSize(gridSZ); - list->setIconSize(QSize(icosize,icosize)); - QDir dir(QDir::homePath()+"/Desktop"); - QFileInfoList files = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Type | QDir::DirsFirst); - for(int i=0; i<files.length(); i++){ - QListWidgetItem *it = new QListWidgetItem; - it->setSizeHint(gridSZ); //ensure uniform item sizes - //it->setForeground(QBrush(Qt::black, Qt::Dense2Pattern)); //Try to use a font color which will always be visible - it->setTextAlignment(Qt::AlignCenter); - it->setWhatsThis(files[i].absoluteFilePath()); - QString txt; - if(files[i].isDir()){ - it->setIcon( LXDG::findIcon("folder","") ); - txt = files[i].fileName(); - }else if(files[i].suffix() == "desktop" ){ - XDGDesktop desk(files[i].absoluteFilePath()); - if(desk.isValid()){ - it->setIcon( LXDG::findIcon(desk.icon,"unknown") ); - if(desk.name.isEmpty()){ - txt = files[i].fileName(); - }else{ - txt = desk.name; - } - }else{ - //Revert back to a standard file handling - it->setIcon( LXDG::findMimeIcon(files[i].fileName()) ); - txt = files[i].fileName(); - } - }else if(LUtils::imageExtensions().contains(files[i].suffix().toLower()) ){ - it->setIcon( QIcon( QPixmap(files[i].absoluteFilePath()).scaled(icosize,icosize,Qt::IgnoreAspectRatio, Qt::SmoothTransformation) ) ); - txt = files[i].fileName(); - }else{ - it->setIcon( LXDG::findMimeIcon( files[i].fileName() ) ); - txt = files[i].fileName(); - } - //Add the sym-link overlay to the icon as necessary - if(files[i].isSymLink()){ - QImage img = it->icon().pixmap(QSize(icosize,icosize)).toImage(); - int oSize = icosize/2; //overlay size - QPixmap overlay = LXDG::findIcon("emblem-symbolic-link").pixmap(oSize,oSize).scaled(oSize,oSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); - QPainter painter(&img); - painter.drawPixmap(icosize-oSize,icosize-oSize,overlay); //put it in the bottom-right corner - it->setIcon( QIcon(QPixmap::fromImage(img)) ); - } - //Now adjust the visible text as necessary based on font/grid sizing - it->setToolTip(txt); - if(this->fontMetrics().width(txt) > (gridSZ.width()-4) ){ - //int dash = this->fontMetrics().width("-"); - //Text too long, try to show it on two lines - txt = txt.section(" ",0,2).replace(" ","\n"); //First take care of any natural breaks - if(txt.contains("\n")){ - //need to check each line - QStringList txtL = txt.split("\n"); - for(int i=0; i<txtL.length(); i++){ txtL[i] = this->fontMetrics().elidedText(txtL[i], Qt::ElideRight, gridSZ.width()-4); } - 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()-4)); - //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); - if( (i%10) == 0){ QApplication::processEvents(); }//keep the UI snappy, every 10 items - } - list->setFlow(QListWidget::TopToBottom); //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(){ - QList<QListWidgetItem*> sel = list->selectedItems(); - for(int i=0; i<sel.length(); i++){ - LSession::LaunchApplication("lumina-fileinfo \""+sel[i]->whatsThis()); - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktopview/DesktopViewPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktopview/DesktopViewPlugin.h deleted file mode 100644 index 046b6e5c..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/desktopview/DesktopViewPlugin.h +++ /dev/null @@ -1,55 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This plugin is a listing/launcher for things in the ~/Desktop folder -//=========================================== -#ifndef _LUMINA_DESKTOP_DESKTOP_VIEW_PLUGIN_H -#define _LUMINA_DESKTOP_DESKTOP_VIEW_PLUGIN_H - -#include <QListWidget> -#include <QVBoxLayout> -#include <QTimer> -#include <QFileSystemWatcher> -#include <QMouseEvent> - -#include "../LDPlugin.h" - -class DesktopViewPlugin : public LDPlugin{ - Q_OBJECT -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; - -private slots: - void runItems(); - void copyItems(); - void cutItems(); - void deleteItems(); - void showMenu(const QPoint&); - void increaseIconSize(); - void decreaseIconSize(); - void updateContents(); - void displayProperties(); - - -public slots: - void LocaleChange(){ - QTimer::singleShot(0,this, SLOT(updateContents())); - } - void ThemeChange(){ - QTimer::singleShot(0,this, SLOT(updateContents())); - } - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/LXDG-DBusNotifier.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/LXDG-DBusNotifier.h deleted file mode 100644 index 64413e95..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/LXDG-DBusNotifier.h +++ /dev/null @@ -1,17 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// Simple DBUS message handler for the FreeDesktop desktop notifications specification - - -class LXDG-DBusNotifier : public QDBusVirtualObkect{ - Q_OBJECT -public: - -private: - - -}; diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/MessageCenter.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/MessageCenter.cpp deleted file mode 100644 index df07a122..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/MessageCenter.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "MessageCenter.h" - -#include <LuminaXDG.h> -#include <QVBoxLayout> -#include <QHBoxLayout> -#include <QDBusConnection> -#include <QDBusConnectionInterface> - -MessageCenterPlugin::MessageCenterPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ - //Setup the UI - QVBoxLayout *vlay = new QVBoxLayout(); - this->setLayout( new QVBoxLayout() ); - this->layout()->setContentsMargins(0,0,0,0); - vlay->setContentsMargins(3,3,3,3); - frame = new QFrame(this); - frame->setObjectName("messagecenterbase"); - this->layout()->addWidget(frame); - frame->setLayout(vlay); - - - //Setup the title bar header buttons - QHBoxLayout *hlay = new QHBoxLayout(); - tool_clearall = new QToolButton(this); - tool_clearall->setAutoRaise(true); - tool_clearone = new QToolButton(this); - tool_clearone->setAutoRaise(true); - QWidget *spacer = new QWidget(this); - spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - hlay->addWidget(spacer); - hlay->addWidget(tool_clearone); - hlay->addWidget(tool_clearall); - vlay->addLayout(hlay); - - //Setup the main text widget - list_messages = new QListWidget(this); - list_messages->setSelectionMode(QAbstractItemView::SingleSelection); - list_messages->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - vlay->addWidget(list_messages); - - //Now setup the initial values - this->setInitialSize(200,300); - //Setup the button connections - connect(tool_clearall, SIGNAL(clicked()), this, SLOT(clearAllMessages()) ); - connect(tool_clearone, SIGNAL(clicked()), this, SLOT(clearSelectedMessage()) ); - - //Setup the DBUS signals/slots - if(QDBusConnection::sessionBus().isConnected()){ - if( QDBusConnection::sessionBus().registerService("org.freedesktop.Notifications") ){ - //Was able to register this service, also register everything it can do... - //SUPPORTED: "body", "body-hyperlinks", "body-markup", "icon-static" - - - } - QDBusConnection::sessionBus().connect("", "", "org.freedesktop.Notifications", "Notify", this, SLOT(newMessage(QString, uint, QString, QString, QString, QStringList, dict, int)) ); - QDBusConnection::sessionBus().interface().call("AddMatch", "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'"); - qDebug() << "Available Session DBUS Services:" << QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); - //connect(QString(), QString(), - } - if(QDBusConnection::systemBus().isConnected()){ - qDebug() << "Available System DBUS Services:" << QDBusConnection::systemBus().interface()->registeredServiceNames().value(); - } - - QTimer::singleShot(0,this, SLOT(loadIcons()) ); -} - -MessageCenterPlugin::~MessageCenterPlugin(){ - -} - -void MessageCenterPlugin::newMessage(QString summary, QString body){ - qDebug() << "New Message:" << summary, body; -} - -void MessageCenterPlugin::clearAllMessages(){ - list_messages->clear(); -} - -void MessageCenterPlugin::clearSelectedMessage(){ - if( list_messages->currentItem()==0){ return; } //nothing selected - list_messages->removeItemWidget( list_messages->currentItem() ); -} - - -void MessageCenterPlugin::loadIcons(){ - tool_clearall->setIcon( LXDG::findIcon("edit-clear-list","") ); - tool_clearall->setToolTip( tr("Clear all messages") ); - tool_clearone->setIcon( LXDG::findIcon("edit-delete","") ); - tool_clearone->setToolTip( tr("Clear selected message") ); - -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/MessageCenter.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/MessageCenter.h deleted file mode 100644 index 8491546f..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/messagecenter/MessageCenter.h +++ /dev/null @@ -1,48 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This plugin is a simple DBUS monitor which display's messages that come in -//=========================================== -#ifndef _LUMINA_DESKTOP_MESSAGE_CENTER_PLUGIN_H -#define _LUMINA_DESKTOP_MESSAGE_CENTER_PLUGIN_H - -#include <QListWidget> -#include <QToolButton> -#include <QFrame> - -#include <QTimer> -#include "../LDPlugin.h" - -class MessageCenterPlugin : public LDPlugin{ - Q_OBJECT -public: - MessageCenterPlugin(QWidget* parent, QString ID); - ~MessageCenterPlugin(); - -private: - //QDBusConnection *sess, *sys; - QListWidget *list_messages; - QFrame *frame; - QToolButton *tool_clearall; //clear all messages - QToolButton *tool_clearone; //clear selected message - -private slots: - //void newMessage(QDBusMessage *message); - void clearAllMessages(); - void clearSelectedMessage(); - - void loadIcons(); - -public slots: - void LocaleChange(){ - QTimer::singleShot(0,this, SLOT(loadIcons())); - } - void ThemeChange(){ - QTimer::singleShot(0,this, SLOT(loadIcons())); - } - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/notepad/NotepadPlugin.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/notepad/NotepadPlugin.cpp deleted file mode 100644 index 6d321305..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/notepad/NotepadPlugin.cpp +++ /dev/null @@ -1,330 +0,0 @@ -#include "NotepadPlugin.h" - -#include <LuminaXDG.h> -#include "LSession.h" -#include <LUtils.h> -#include <QDir> -#include <QFileDialog> -#include <QInputDialog> -#include <QtConcurrent> - -NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ - //qDebug() << "Creating Notepad Plugin:"; - QVBoxLayout *vlay = new QVBoxLayout(); - this->setLayout( new QVBoxLayout() ); - this->layout()->setContentsMargins(0,0,0,0); - vlay->setContentsMargins(3,3,3,3); - frame = new QFrame(this); - frame->setObjectName("notepadbase"); - //frame->setStyleSheet("QFrame#notepadbase{border-width: 1px; background: rgba(255,255,255,50); color: black;} QFrame{ border: none; border-radius: 3px; background: rgba(255,255,255,100); color: black;}"); - this->layout()->addWidget(frame); - frame->setLayout(vlay); - - if(!QFile::exists(QDir::homePath()+"/Notes")){ - //Create the notes directory if non-existant - QDir dir; - dir.mkpath(QDir::homePath()+"/Notes"); - } - watcher = new QFileSystemWatcher(this); - //Always watch the notes directory for new files/changes - watcher->addPath(QDir::homePath()+"/Notes"); - - typeTimer = new QTimer(this); - typeTimer->setInterval(1000); // 1 second before it saves - typeTimer->setSingleShot(true); //compress lots of signals into a single save - - updating = false; - //Setup the title bar header buttons - QHBoxLayout *hlay = new QHBoxLayout(); - config = new QToolButton(this); - config->setAutoRaise(true); - config->setMenu(new QMenu(this)); - config->setPopupMode(QToolButton::InstantPopup); - /*open = new QToolButton(this); - open->setAutoRaise(true); - add = new QToolButton(this); - add->setAutoRaise(true); - rem = new QToolButton(this); - rem->setAutoRaise(true);*/ - cnote = new QComboBox(this); - - hlay->addWidget(cnote); - hlay->addWidget(config); - //hlay->addWidget(open); - //hlay->addWidget(add); - //hlay->addWidget(rem); - vlay->addLayout(hlay); - - //Setup the main text widget - edit = new QPlainTextEdit(this); - edit->setReadOnly(false); - edit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - vlay->addWidget(edit); - edit->setContextMenuPolicy(Qt::NoContextMenu); - - //Now load the new file-based system for saving notes - //qDebug() << "Saving a new setting"; - this->saveSetting("customFile",""); //always clear this when the plugin is initialized (only maintained per-session) - //qDebug() << "Loading Notes Dir"; - QTimer::singleShot(10, this, SLOT(notesDirChanged())); - //qDebug() << "Set Sizing"; - - //qDebug() << "Connect Signals/slots"; - //Setup the button connections - /*connect(open, SIGNAL(clicked()), this, SLOT(openNoteClicked()) ); - connect(add, SIGNAL(clicked()), this, SLOT(newNoteClicked()) ); - connect(rem, SIGNAL(clicked()), this, SLOT(remNote()) );*/ - //connect(config, SIGNAL(clicked()), this, SLOT(openConfigMenu()) ); - connect(edit, SIGNAL(textChanged()), this, SLOT(newTextAvailable()) ); - connect(cnote, SIGNAL(currentIndexChanged(QString)), this, SLOT(noteChanged()) ); - connect(typeTimer, SIGNAL(timeout()), this, SLOT(updateContents()) ); - connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(notesDirChanged()) ); //re-load the available notes - connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(noteChanged()) ); //re-load the current file - QTimer::singleShot(0,this, SLOT(loadIcons()) ); - //qDebug() << " - Done with init"; -} - -NotePadPlugin::~NotePadPlugin(){ - -} - - -void NotePadPlugin::openNote(){ - //qDebug() << "Open New Note:"; - //Prompt for a name for the new note - QFileDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint ); - dlg.setFileMode(QFileDialog::ExistingFile); - dlg.setAcceptMode(QFileDialog::AcceptOpen); - dlg.setNameFilters( QStringList() << tr("Note Files (*.note)") << tr("Text Files (*)")); - dlg.setWindowTitle(tr("Open a note file")); - dlg.setWindowIcon( LXDG::findIcon("document-open","") ); - dlg.setDirectory(QDir::homePath()); //start in the home directory - //ensure it is centered on the current screen - QPoint center = QApplication::desktop()->screenGeometry(this).center(); - dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) ); - dlg.show(); - while( dlg.isVisible() ){ - QApplication::processEvents(); - } - QStringList sel = dlg.selectedFiles(); - if(sel.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled - QString fullpath = sel.first(); - QString name = fullpath.section("/",-1); - //qDebug() << " - Found Note:" << name << fullpath; - int index = cnote->findText(name, Qt::MatchExactly | Qt::MatchCaseSensitive); - if(QFile::exists(fullpath) && index <0){ - //Alternate option of searching for the file in the list - index = cnote->findText(fullpath, Qt::MatchExactly | Qt::MatchCaseSensitive); - } - if(index>=0){ - //This note already exists: just load it - cnote->setCurrentIndex(index); - }else{ - //New note - add it to the end of the list and then load it - cnote->addItem(name, fullpath); - this->saveSetting("customFile", fullpath); //save this as a custom file - cnote->setCurrentIndex( cnote->count()-1 ); - QTimer::singleShot(1000, this, SLOT(notesDirChanged())); //Make sure to refresh the list (only one custom file at a time) - } -} - -QString NotePadPlugin::newNoteName(QString oldname, bool tryagain){ - //Prompt for a name for the new note - //qDebug() << "Create new note"; - QInputDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint ); - dlg.setInputMode(QInputDialog::TextInput); - dlg.setLabelText(tr("Name:")); - dlg.setTextEchoMode(QLineEdit::Normal); - if(tryagain){ dlg.setWindowTitle(tr("Invalid Note Name: Try Again")); } - else{ dlg.setWindowTitle(tr("Select a Note Name")); } - dlg.setWindowIcon( LXDG::findIcon("document-new","") ); - dlg.setTextValue(oldname); - //ensure it is centered on the current screen - QPoint center = QApplication::desktop()->screenGeometry(this).center(); - dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) ); - dlg.show(); - while( dlg.isVisible() ){ - //this->thread()->usleep(300000); //300 ms between updates - QApplication::processEvents(); - } - QString name = dlg.textValue(); - //make sure to remove any "bad" characters from the name - name.remove("\""); name.remove(";"); name.remove("\'"); name.replace("/","_"); - if(name.isEmpty() || dlg.result()!=QDialog::Accepted){ return ""; } //cancelled - //Check validity of the new note filename - QString fullpath = QDir::homePath()+"/Notes/"+name; - if(!fullpath.endsWith(".note")){ fullpath.append(".note"); } - if(QFile::exists(fullpath)){ - return newNoteName(name, true); //try again - } - return name; //good name - go ahead and return it -} - -void NotePadPlugin::updateConfigMenu(){ - //Re-create the menu and open it - config->menu()->clear(); - config->menu()->addAction(LXDG::findIcon("document-open",""), tr("Open Text File"), this, SLOT(openNoteClicked()) ); - config->menu()->addAction(LXDG::findIcon("document-new",""), tr("Create a Note"), this, SLOT(newNoteClicked()) ); - if(cnote->currentIndex()>=0){ - config->menu()->addSeparator(); - config->menu()->addAction(LXDG::findIcon("document-edit",""), tr("Rename Note"), this, SLOT(renameNote()) ); - config->menu()->addAction(LXDG::findIcon("document-close",""), tr("Delete Note"), this, SLOT(remNote()) ); - } -} - -void NotePadPlugin::openNoteClicked(){ - openNote(); -} - -void NotePadPlugin::newNoteClicked(){ - //QtConcurrent::run(this, &NotePadPlugin::newNote); - QString name = newNoteName(); - if(name.isEmpty()){ return; } - QString fullpath = QDir::homePath()+"/Notes/"+name; - if(!fullpath.endsWith(".note")){ fullpath.append(".note"); } - //qDebug() << " - New Note:" << name << fullpath; - int index = cnote->findText(name, Qt::MatchExactly | Qt::MatchCaseSensitive); - if(QFile::exists(fullpath) && index <0){ - //Alternate option of searching for the file in the list - index = cnote->findText(fullpath, Qt::MatchExactly | Qt::MatchCaseSensitive); - } - if(index>=0){ - //This note already exists: just load it - cnote->setCurrentIndex(index); - }else{ - //New note - add it to the end of the list and then load it - cnote->addItem(name, fullpath); - cnote->setCurrentIndex( cnote->count()-1 ); - } -} - -void NotePadPlugin::remNote(){ - QString note = cnote->currentData().toString(); - if(note.isEmpty()){ return; } - watcher->removePath(note); //remove this file from the watcher - this->saveSetting("currentFile",""); //reset the internal value - QFile::remove(note); //remove the file - //if(!note.startsWith(QDir::homePath()+"/Notes/") ){ - //If the file was not in the notes directory, need to manually prompt for a re-load - // otherwise, the directory watcher will catch it and trigger a re-load (no need to double-load) - notesDirChanged(); - //} -} - -void NotePadPlugin::renameNote(){ - int item = cnote->currentIndex(); - if(item<0){ return; } //nothing selected - QString oldpath = cnote->currentData().toString(); - if(oldpath.isEmpty() || !oldpath.endsWith(".note")){ return; } - QString name = newNoteName(cnote->currentText()); - if(name.isEmpty()){ return; } - QString fullpath = QDir::homePath()+"/Notes/"+name; - if(!fullpath.endsWith(".note")){ fullpath.append(".note"); } - //qDebug() << " - New Note:" << name << fullpath; - //Update the current item data to point to this file - cnote->setItemText(item, name); - cnote->setItemData(item, fullpath); - //Now move the file over - QFile::rename(oldpath, fullpath); - noteChanged(); -} - -void NotePadPlugin::newTextAvailable(){ - if(updating){ return; } //programmatic change of the widget - if(typeTimer->isActive()){ typeTimer->stop(); } - typeTimer->start(); -} - -void NotePadPlugin::updateContents(){ - if(updating){ return; } //this was a programmatic change to the widget - //The text was changed in the plugin - save it in the file - QString note = cnote->currentData().toString(); - updating = true; - LUtils::writeFile(note, edit->toPlainText().split("\n"), true); - QApplication::processEvents(); //make sure to process/discard the file changed signal before disabling the flag - updating = false; -} - -void NotePadPlugin::notesDirChanged(){ - if(updating){ return; } - QString cfile = this->readSetting("currentFile","").toString(); - QStringList notes; - QDir dir(QDir::homePath()+"/Notes"); - QStringList files = dir.entryList(QStringList() << "*.note", QDir::Files | QDir::NoDotAndDotDot, QDir::Name); - for(int i=0; i<files.length(); i++){ - notes << dir.absoluteFilePath(files[i]); - } - QString custom = this->readSetting("customFile","").toString(); - if(!custom.isEmpty() && QFile::exists(custom) ){ notes << custom; } - //qDebug() << "Available Notes:" << notes << cfile; - //Now update the UI list - updating = true; //don't refresh the UI until done changing lists - cnote->clear(); - bool found = false; - for(int i=0; i<notes.length(); i++){ - QString name = notes[i].section("/",-1); - if(name.endsWith(".note")){ name.chop(5); } - cnote->addItem(name, notes[i]); - if(notes[i]==cfile){ cnote->setCurrentIndex(i); found = true;} - } - if(!found && !cfile.isEmpty() && QFile::exists(cfile)){ - //Current note is a manually-loaded text file - cnote->addItem(cfile.section("/",-1), cfile); - cnote->setCurrentIndex( cnote->count()-1 ); //last item - found = true; - } - if(!found && cnote->count()>0){ cnote->setCurrentIndex(0); } - updating =false; - noteChanged(); -} - -void NotePadPlugin::noteChanged(){ - if(updating){ return; } - updating =true; - QString note; - if(cnote->currentIndex()>=0){ - note = cnote->currentData().toString(); - } - QTimer::singleShot(0, this, SLOT(updateConfigMenu()) ); - if(note.isEmpty() && cnote->count()>0){ - updating=false; - cnote->setCurrentIndex(0); - return; - } - QString oldnote = this->readSetting("currentFile","").toString(); - //qDebug() << "Note Changed:" << note << oldnote; - if( oldnote!=note ){ - //Clear the old note file/setting - if(!oldnote.isEmpty()){ - watcher->removePath(oldnote); - this->saveSetting("currentFile",""); - } - if(!note.isEmpty()){ - this->saveSetting("currentFile",note); - watcher->addPath(note); - } - } - - if(!note.isEmpty()){ - QString text = LUtils::readFile(note).join("\n"); - if(text!=edit->toPlainText()){ - edit->setPlainText( text ); - } - }else{ - edit->clear(); - } - //If no notes available - disable the editor until a new one is created - edit->setEnabled(!note.isEmpty()); - //rem->setEnabled(!note.isEmpty()); - cnote->setEnabled(!note.isEmpty()); - //leave the new/open buttons enabled all the time - updating = false; -} - - -void NotePadPlugin::loadIcons(){ - /*open->setIcon( LXDG::findIcon("document-open","") ); - add->setIcon( LXDG::findIcon("document-new","") ); - rem->setIcon( LXDG::findIcon("document-close","") );*/ - config->setIcon( LXDG::findIcon("configure","") ); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/notepad/NotepadPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/notepad/NotepadPlugin.h deleted file mode 100644 index 5084dadf..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/notepad/NotepadPlugin.h +++ /dev/null @@ -1,66 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This plugin is a simple text editor for notes on the desktop -//=========================================== -#ifndef _LUMINA_DESKTOP_NOTEPAD_PLUGIN_H -#define _LUMINA_DESKTOP_NOTEPAD_PLUGIN_H - -#include <QPlainTextEdit> -#include <QToolButton> -#include <QComboBox> -#include <QVBoxLayout> -#include <QTimer> -#include <QFileSystemWatcher> -#include "../LDPlugin.h" - -class NotePadPlugin : public LDPlugin{ - Q_OBJECT -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 *config; //*open, *add, *rem; - QComboBox *cnote; - QFrame *frame; - QFileSystemWatcher *watcher; - bool updating; - QTimer *typeTimer; - - void openNote(); - QString newNoteName(QString oldname = "", bool tryagain = false); - -private slots: - void updateConfigMenu(); - - void openNoteClicked(); - void newNoteClicked(); - void remNote(); - void renameNote(); - void newTextAvailable(); - void updateContents(); - - void notesDirChanged(); - void noteChanged(); - - void loadIcons(); - -public slots: - void LocaleChange(){ - QTimer::singleShot(0,this, SLOT(noteChanged())); - } - void ThemeChange(){ - QTimer::singleShot(0,this, SLOT(loadIcons())); - } - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/quickcontainer/QuickDPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/quickcontainer/QuickDPlugin.h deleted file mode 100644 index d6039ac0..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/quickcontainer/QuickDPlugin.h +++ /dev/null @@ -1,51 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class is a simple container for a QtQuick plugin -//=========================================== -#ifndef _LUMINA_DESKTOP_DESKTOP_PLUGIN_QUICK_H -#define _LUMINA_DESKTOP_DESKTOP_PLUGIN_QUICK_H - -#include <QQuickWidget> -#include <QVBoxLayout> -#include "../LDPlugin.h" - -#include <LUtils.h> - -class QuickDPlugin : public LDPlugin{ - Q_OBJECT -public: - QuickDPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ - this->setLayout( new QVBoxLayout()); - this->layout()->setContentsMargins(0,0,0,0); - container = new QQuickWidget(this); - container->setResizeMode(QQuickWidget::SizeRootObjectToView); - connect(container, SIGNAL(statusChanged(QQuickWidget::Status)), this, SLOT(statusChange(QQuickWidget::Status)) ); - 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()); - } - - ~QuickDPlugin(){} - - virtual QSize defaultPluginSize(){ - // The returned QSize is in grid points (typically 100 or 200 pixels square) - return QSize(2,2); - } -private: - QQuickWidget *container; - -private slots: - void statusChange(QQuickWidget::Status status){ - if(status == QQuickWidget::Error){ - qDebug() << "Quick Widget Error:" << this->ID(); - container->setSource(QUrl()); //clear out the script - experienced an error - } - } - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.cpp deleted file mode 100644 index c330d6c0..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.cpp +++ /dev/null @@ -1,363 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2016, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "RSSFeedPlugin.h" -#include "ui_RSSFeedPlugin.h" - -#include <LuminaXDG.h> -#include "LSession.h" -#include <LUtils.h> -#include <QDir> -#include <QFileDialog> -#include <QInputDialog> -#include <QtConcurrent> - -RSSFeedPlugin::RSSFeedPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID), ui(new Ui::RSSFeedPlugin()){ - ui->setupUi(this); - //Load the global settings - setprefix = "rssreader/"; //this structure/prefix should be used for *all* plugins of this type - RSS = new RSSReader(this, setprefix); - ui->text_feed->setContextMenuPolicy(Qt::NoContextMenu); - //Create the options menu - optionsMenu = new QMenu(this); - ui->tool_options->setMenu(optionsMenu); - presetMenu = new QMenu(this); - ui->tool_add_preset->setMenu(presetMenu); - - //Setup any signal/slot connections - connect(ui->push_back1, SIGNAL(clicked()), this, SLOT(backToFeeds()) ); - connect(ui->push_back2, SIGNAL(clicked()), this, SLOT(backToFeeds()) ); - connect(ui->push_back3, SIGNAL(clicked()), this, SLOT(backToFeeds()) ); - connect(ui->push_save_settings, SIGNAL(clicked()), this, SLOT(saveSettings()) ); - connect(RSS, SIGNAL(rssChanged(QString)), this, SLOT(RSSItemChanged(QString)) ); - connect(RSS, SIGNAL(newChannelsAvailable()), this, SLOT(UpdateFeedList())); - connect(ui->tool_gotosite, SIGNAL(clicked()), this, SLOT(openFeedPage()) ); - connect(ui->push_rm_feed, SIGNAL(clicked()), this, SLOT(removeFeed()) ); - connect(ui->push_add_url, SIGNAL(clicked()), this, SLOT(addNewFeed()) ); - connect(ui->combo_feed, SIGNAL(currentIndexChanged(int)), this, SLOT(currentFeedChanged()) ); - - connect(presetMenu, SIGNAL(triggered(QAction*)), this, SLOT(loadPreset(QAction*)) ); - - updateOptionsMenu(); - QTimer::singleShot(0,this, SLOT(ThemeChange()) ); - //qDebug() << " - Done with init"; - QStringList feeds; - if( !LSession::handle()->DesktopPluginSettings()->contains(setprefix+"currentfeeds") ){ - //First-time run of the plugin - automatically load the default feeds - feeds = LOS::RSSFeeds(); - for(int i=0; i<feeds.length(); i++){ feeds[i] = feeds[i].section("::::",1,-1); } //just need url right now - feeds << "http://lumina-desktop.org/?feed=rss2"; //Lumina Desktop blog feed - LSession::handle()->DesktopPluginSettings()->setValue(setprefix+"currentfeeds", feeds); - }else{ - feeds = LSession::handle()->DesktopPluginSettings()->value(setprefix+"currentfeeds",QStringList()).toStringList(); - } - RSS->addUrls(feeds); - backToFeeds(); //always load the first page -} - -RSSFeedPlugin::~RSSFeedPlugin(){ - -} - -//================ -// PRIVATE -//================ -void RSSFeedPlugin::updateOptionsMenu(){ - optionsMenu->clear(); - optionsMenu->addAction(LXDG::findIcon("list-add",""), tr("Add RSS Feed"), this, SLOT(openFeedNew()) ); - optionsMenu->addAction(LXDG::findIcon("help-about",""), tr("View Feed Details"), this, SLOT(openFeedInfo()) ); - optionsMenu->addAction(LXDG::findIcon("configure",""), tr("Settings"), this, SLOT(openSettings()) ); - optionsMenu->addSeparator(); - optionsMenu->addAction(LXDG::findIcon("download",""), tr("Update Feeds Now"), this, SLOT(resyncFeeds()) ); - - presetMenu->clear(); - QStringList feeds = LOS::RSSFeeds(); - feeds << tr("Lumina Desktop RSS")+"::::http://lumina-desktop.org/?feed=rss2"; - feeds.sort(); - for(int i=0; i<feeds.length(); i++){ - QAction *tmp = presetMenu->addAction(feeds[i].section("::::",0,0) ); - tmp->setWhatsThis( feeds[i].section("::::",1,-1) ); - } -} - -void RSSFeedPlugin::checkFeedNotify(){ - bool notify = false; - for(int i=0; i<ui->combo_feed->count() && !notify; i++){ - if( !ui->combo_feed->itemData(i, Qt::WhatsThisRole).toString().isEmpty()){ notify = true; } - } - QString style; - if(notify){ style = "QComboBox{ background-color: rgba(255,0,0,120); }"; } - ui->combo_feed->setStyleSheet(style); -} - -//Simplification functions for loading feed info onto widgets -void RSSFeedPlugin::updateFeed(QString ID){ - //Now clear/update the feed viewer (HTML) - ui->text_feed->clear(); - if(ID.isEmpty()){ return; } //nothing to show - - //Save the datetime this feed was read - LSession::handle()->DesktopPluginSettings()->setValue(setprefix+"feedReads/"+ID, QDateTime::currentDateTime() ); - //Get the color to use for hyperlinks (need to specify in html) - QString color = ui->text_feed->palette().text().color().name(); //keep the hyperlinks the same color as the main text (different formatting still applies) - QString html; - RSSchannel data = RSS->dataForID(ID); - ui->label_lastupdate->setText( data.lastsync.toString(Qt::DefaultLocaleShortDate) ); - // - generate the html - // html.append("<ul style=\"margin-left: 3px;\">\n"); - for(int i=0; i<data.items.length(); i++){ - //html.append("<li>"); - html.append("<h4><a href=\""+data.items[i].link+"\" style=\"color: "+color+";\">"+data.items[i].title+"</a></h4>"); - if(!data.items[i].pubdate.isNull() || !data.items[i].author.isEmpty()){ - html.append("<i>("); - if(!data.items[i].pubdate.isNull()){ html.append(data.items[i].pubdate.toString(Qt::DefaultLocaleShortDate)); } - if(!data.items[i].author.isEmpty()){ - if(!html.endsWith("(")){ html.append(", "); } //spacing between date/author - if(!data.items[i].author_email.isEmpty()){ html.append("<a href=\"mailto:"+data.items[i].author_email+"\" style=\"color: "+color+";\">"+data.items[i].author+"</a>"); } - else{ html.append(data.items[i].author); } - } - html.append(")</i><br>"); - } - html.append(data.items[i].description); - //html.append("</li>\n"); - if(i+1 < data.items.length()){ html.append("<br>"); } - } - //html.append("</ul>\n"); - // - load that html into the viewer - ui->text_feed->setHtml(html); -} - -void RSSFeedPlugin::updateFeedInfo(QString ID){ - ui->page_feed_info->setWhatsThis(ID); - ui->text_feed_info->clear(); - if(ID.isEmpty()){ return; } - //Get the color to use for hyperlinks (need to specify in html) - QString color = ui->text_feed->palette().text().color().name(); //keep the hyperlinks the same color as the main text (different formatting still applies) - QString html; - RSSchannel data = RSS->dataForID(ID); - // - generate the html - // <a href=\""+LINK+"\" style=\"color: "+color+";\">"+TEXT+"</a> - html.append( QString(tr("Feed URL: %1")).arg("<a href=\""+data.originalURL+"\" style=\"color: "+color+";\">"+data.originalURL+"</a>") +"<br><hr>"); - html.append( QString(tr("Title: %1")).arg(data.title) +"<br>"); - html.append( QString(tr("Description: %1")).arg(data.description) +"<br>"); - html.append( QString(tr("Website: %1")).arg("<a href=\""+data.link+"\" style=\"color: "+color+";\">"+data.link+"</a>") +"<br><hr>"); - if(!data.lastBuildDate.isNull()){ html.append( QString(tr("Last Build Date: %1")).arg(data.lastBuildDate.toString(Qt::DefaultLocaleShortDate)) +"<br>"); } - html.append( QString(tr("Last Sync: %1")).arg(data.lastsync.toString(Qt::DefaultLocaleShortDate)) +"<br>"); - html.append( QString(tr("Next Sync: %1")).arg(data.nextsync.toString(Qt::DefaultLocaleShortDate)) +"<br>"); - // - load that html into the viewer - ui->text_feed_info->setHtml(html); -} - -//================ -// PRIVATE SLOTS -//================ -void RSSFeedPlugin::loadIcons(){ - ui->tool_options->setIcon( LXDG::findIcon("configure","") ); - ui->tool_gotosite->setIcon( LXDG::findIcon("applications-internet","") ); - ui->push_back1->setIcon( LXDG::findIcon("go-previous","") ); - ui->push_back2->setIcon( LXDG::findIcon("go-previous","") ); - ui->push_back3->setIcon( LXDG::findIcon("go-previous","") ); - ui->push_rm_feed->setIcon( LXDG::findIcon("list-remove","") ); - ui->push_add_url->setIcon( LXDG::findIcon("list-add","") ); - ui->push_save_settings->setIcon( LXDG::findIcon("document-save","") ); - ui->tool_add_preset->setIcon( LXDG::findIcon("bookmark-new-list","") ); -} - -//GUI slots -// - Page management -void RSSFeedPlugin::backToFeeds(){ - ui->stackedWidget->setCurrentWidget(ui->page_feed); -} - -void RSSFeedPlugin::openFeedInfo(){ - QString ID = ui->combo_feed->currentData().toString(); - if(ID.isEmpty()){ return; } - updateFeedInfo(ID); - ui->stackedWidget->setCurrentWidget(ui->page_feed_info); - -} - -void RSSFeedPlugin::openFeedNew(){ - ui->line_new_url->setText(""); - ui->stackedWidget->setCurrentWidget(ui->page_new_feed); -} - -void RSSFeedPlugin::openSettings(){ - //Sync the widget with the current settings - QSettings *set = LSession::handle()->DesktopPluginSettings(); - - ui->check_manual_sync->setChecked( set->value(setprefix+"manual_sync_only", false).toBool() ); - int DI = set->value(setprefix+"default_interval_minutes", 60).toInt(); - if(DI<1){ DI = 60; } - if( (DI%60) == 0 ){DI = DI/60; ui->combo_sync_units->setCurrentIndex(1); } //hourly setting - else{ ui->combo_sync_units->setCurrentIndex(1); } //minutes setting - ui->spin_synctime->setValue(DI); - - //Now show the page - ui->stackedWidget->setCurrentWidget(ui->page_settings); -} - -// - Feed Management -void RSSFeedPlugin::addNewFeed(){ - if(ui->line_new_url->text().isEmpty()){ return; } //nothing to add - //Validate the URL - QUrl url(ui->line_new_url->text()); - if(!url.isValid()){ - ui->line_new_url->setFocus(); - return; - } - //Add the URL to the settings file for next login - QStringList feeds = LSession::handle()->DesktopPluginSettings()->value(setprefix+"currentfeeds",QStringList()).toStringList(); - feeds << url.toString(); - LSession::handle()->DesktopPluginSettings()->setValue(setprefix+"currentfeeds", feeds); - - //Set this URL as the current selection - ui->combo_feed->setWhatsThis(url.toString()); //hidden field - will trigger an update in a moment - //Add the URL to the backend - RSS->addUrls(QStringList() << url.toString()); - //UpdateFeedList(); //now re-load the feeds which are available - - //Now go back to the main page - backToFeeds(); -} - -void RSSFeedPlugin::loadPreset(QAction *act){ - ui->line_new_url->setText( act->whatsThis() ); -} - -void RSSFeedPlugin::removeFeed(){ - QString ID = ui->page_feed_info->whatsThis(); - if(ID.isEmpty()){ return; } - //Remove from the RSS feed object - RSSchannel info = RSS->dataForID(ID); - RSS->removeUrl(ID); - //Remove the URL from the settings file for next login - QStringList feeds = LSession::handle()->DesktopPluginSettings()->value(setprefix+"currentfeeds",QStringList()).toStringList(); - feeds.removeAll(info.originalURL); - LSession::handle()->DesktopPluginSettings()->setValue(setprefix+"currentfeeds", feeds); - LSession::handle()->DesktopPluginSettings()->remove(setprefix+"feedReads/"+ID); - //Now go back to the main page - backToFeeds(); -} - -void RSSFeedPlugin::resyncFeeds(){ - RSS->addUrls( LSession::handle()->DesktopPluginSettings()->value(setprefix+"currentfeeds",QStringList()).toStringList() ); - RSS->syncNow(); -} - -// - Feed Interactions -void RSSFeedPlugin::currentFeedChanged(){ - QString ID = ui->combo_feed->currentData().toString(); - //Remove the "unread" color/flag from the feed - ui->combo_feed->setItemData( ui->combo_feed->currentIndex(), QBrush(Qt::transparent) , Qt::BackgroundRole); - ui->combo_feed->setItemData( ui->combo_feed->currentIndex(), "", Qt::WhatsThisRole); - checkFeedNotify(); - updateFeed(ID); -} - -void RSSFeedPlugin::openFeedPage(){ //Open main website for feed - QString ID = ui->combo_feed->currentData().toString(); - //Find the data associated with this feed - RSSchannel data = RSS->dataForID(ID); - QString url = data.link; - //qDebug() << "Open Feed Page:" << url; - //Now launch the browser - if(!url.isEmpty()){ - LSession::LaunchApplication("lumina-open \""+url+"\""); - } -} - -void RSSFeedPlugin::saveSettings(){ - QSettings *set = LSession::handle()->DesktopPluginSettings(); - set->setValue(setprefix+"manual_sync_only", ui->check_manual_sync->isChecked() ); - int DI = ui->spin_synctime->value(); - if(ui->combo_sync_units->currentIndex()==1){ DI = DI*60; } //convert from hours to minutes - set->setValue(setprefix+"default_interval_minutes", DI); - set->sync(); - - //Now go back to the feeds - backToFeeds(); -} - -//Feed Object interactions -void RSSFeedPlugin::UpdateFeedList(){ - - QString activate = ui->combo_feed->whatsThis(); - if(!activate.isEmpty()){ ui->combo_feed->setWhatsThis(""); } - if(activate.isEmpty()){ activate = ui->combo_feed->currentData().toString(); } // keep current item selected - //Now get/list all the available feeds - QStringList IDS = RSS->channels(); //this is pre-sorted by title of the feed - //qDebug() << "Update RSS Feed List:" << IDS << activate; - for(int i=0; i<IDS.length(); i++){ - bool newitem = false; - if(ui->combo_feed->count()<=i){ newitem = true; } - else{ - QString cid = ui->combo_feed->itemData(i).toString(); - if(IDS[i]!=cid){ - if(IDS.contains(cid)){ newitem = true; } //this item is just out of order - else{ ui->combo_feed->removeItem(i); } //item no longer is valid - } - } - if(newitem){ - //Need to add a new item at this point in the menu - RSSchannel info = RSS->dataForID(IDS[i]); - if(info.title.isEmpty()){ - //invalid/empty channel - ui->combo_feed->insertItem(i, IDS[i], IDS[i]); //just show the URL - }else{ - ui->combo_feed->insertItem(i, info.icon, info.title, IDS[i]); - } - } - } - //Remove any extra items on the end of the list - for(int i=IDS.length(); i<ui->combo_feed->count(); i++){ - ui->combo_feed->removeItem(i); i--; - } - //Now activate the proper item as needed - if(IDS.contains(activate)){ - ui->combo_feed->setCurrentIndex( IDS.indexOf(activate) ); - } - checkFeedNotify(); -} - -void RSSFeedPlugin::RSSItemChanged(QString ID){ - for(int i=0; i<ui->combo_feed->count(); i++){ - if(ui->combo_feed->itemData(i).toString()!=ID){ continue; } - RSSchannel info = RSS->dataForID(ID); - if(info.title.isEmpty()){ - ui->combo_feed->setItemText(i, ID); - ui->combo_feed->setItemIcon(i, LXDG::findIcon("dialog-cancel","") ); - }else{ - ui->combo_feed->setItemText(i, info.title); - ui->combo_feed->setItemIcon(i, info.icon ); - QColor color(Qt::transparent); - if( info.lastBuildDate > LSession::handle()->DesktopPluginSettings()->value(setprefix+"feedReads/"+ID,QDateTime()).toDateTime() ){ - color = QColor(255,10,10,100); //semi-transparent red - ui->combo_feed->setItemData(i, "notify", Qt::WhatsThisRole); - }else{ - ui->combo_feed->setItemData(i, "", Qt::WhatsThisRole); - } - ui->combo_feed->setItemData(i, QBrush(color) , Qt::BackgroundRole); - } - } - if(ID == ui->combo_feed->currentData().toString()){ - currentFeedChanged(); //re-load the current feed - }else{ - checkFeedNotify(); - } -} - -//================== -// PUBLIC SLOTS -//================== -void RSSFeedPlugin::LocaleChange(){ - ui->retranslateUi(this); - updateOptionsMenu(); -} -void RSSFeedPlugin::ThemeChange(){ - QTimer::singleShot(0,this, SLOT(loadIcons())); - updateOptionsMenu(); -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.h deleted file mode 100644 index 68b36760..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.h +++ /dev/null @@ -1,72 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2016, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This plugin is a simple RSS feed reader for the desktop -//=========================================== -#ifndef _LUMINA_DESKTOP_RSS_FEEDER_PLUGIN_H -#define _LUMINA_DESKTOP_RSS_FEEDER_PLUGIN_H - -#include <QTimer> -#include "../LDPlugin.h" - -#include "RSSObjects.h" - -namespace Ui{ - class RSSFeedPlugin; -}; - -class RSSFeedPlugin : public LDPlugin{ - Q_OBJECT -public: - RSSFeedPlugin(QWidget* parent, QString ID); - ~RSSFeedPlugin(); - - virtual QSize defaultPluginSize(){ - // The returned QSize is in grid points (typically 100 or 200 pixels square) - return QSize(3,3); - } -private: - Ui::RSSFeedPlugin *ui; - QMenu *optionsMenu, *presetMenu; - QString setprefix; //settings prefix - RSSReader *RSS; - - void updateOptionsMenu(); - void checkFeedNotify(); //check if unread feeds are available and change the styling a bit as needed - - //Simplification functions for loading feed info onto widgets - void updateFeed(QString ID); - void updateFeedInfo(QString ID); - -private slots: - void loadIcons(); - - //GUI slots - // - Page management - void backToFeeds(); - void openFeedInfo(); - void openFeedNew(); - void openSettings(); - // - Feed Management - void addNewFeed(); // the "add" button (current url in widget on page) - void loadPreset(QAction*); //the add-preset menu - void removeFeed(); // the "remove" button (current feed for page) - void resyncFeeds(); - // - Feed Interactions - void currentFeedChanged(); - void openFeedPage(); //Open the website in a browser - void saveSettings(); - - //Feed Object interactions - void UpdateFeedList(); - void RSSItemChanged(QString ID); - -public slots: - void LocaleChange(); - void ThemeChange(); - -}; -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.ui b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.ui deleted file mode 100644 index dc7acd0b..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSFeedPlugin.ui +++ /dev/null @@ -1,552 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>RSSFeedPlugin</class> - <widget class="QWidget" name="RSSFeedPlugin"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>238</width> - <height>278</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QStackedWidget" name="stackedWidget"> - <property name="currentIndex"> - <number>1</number> - </property> - <widget class="QWidget" name="page_feed"> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QComboBox" name="combo_feed"/> - </item> - <item> - <widget class="QToolButton" name="tool_options"> - <property name="toolTip"> - <string>View Options</string> - </property> - <property name="text"> - <string/> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="label_lastupdate"> - <property name="text"> - <string notr="true"/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_gotosite"> - <property name="toolTip"> - <string>Open Website</string> - </property> - <property name="text"> - <string>More</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - <property name="arrowType"> - <enum>Qt::NoArrow</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QTextBrowser" name="text_feed"> - <property name="undoRedoEnabled"> - <bool>false</bool> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - <property name="html"> - <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - <property name="openLinks"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_feed_info"> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>5</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QPushButton" name="push_back1"> - <property name="text"> - <string>Back to Feeds</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Feed Information</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QTextBrowser" name="text_feed_info"> - <property name="html"> - <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <widget class="QPushButton" name="push_rm_feed"> - <property name="text"> - <string>Remove Feed</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_new_feed"> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QPushButton" name="push_back2"> - <property name="text"> - <string>Back to Feeds</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>New Feed Subscription</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>RSS URL</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_10"> - <item> - <widget class="QLineEdit" name="line_new_url"/> - </item> - <item> - <widget class="QToolButton" name="tool_add_preset"> - <property name="toolTip"> - <string>Load a preset RSS Feed</string> - </property> - <property name="text"> - <string/> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="push_add_url"> - <property name="text"> - <string>Add to Feeds</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_settings"> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <property name="spacing"> - <number>4</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QPushButton" name="push_back3"> - <property name="text"> - <string>Back to Feeds</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Feed Reader Settings</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QCheckBox" name="check_manual_sync"> - <property name="text"> - <string>Manual Sync Only</string> - </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="toolTip"> - <string>Some RSS feeds may request custom update intervals instead of using this setting</string> - </property> - <property name="title"> - <string>Default Sync Interval</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <property name="spacing"> - <number>2</number> - </property> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QSpinBox" name="spin_synctime"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>60</number> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="combo_sync_units"> - <property name="currentText"> - <string>Hour(s)</string> - </property> - <property name="currentIndex"> - <number>1</number> - </property> - <item> - <property name="text"> - <string>Minutes</string> - </property> - </item> - <item> - <property name="text"> - <string>Hour(s)</string> - </property> - </item> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_9"> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="push_save_settings"> - <property name="text"> - <string>Save Settings</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSObjects.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSObjects.cpp deleted file mode 100644 index 0a805252..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSObjects.cpp +++ /dev/null @@ -1,287 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2016, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "RSSObjects.h" -#include <QNetworkRequest> -#include <QXmlStreamReader> - -#include "LSession.h" - -//============ -// PUBLIC -//============ -RSSReader::RSSReader(QObject *parent, QString settingsPrefix) : QObject(parent){ - NMAN = new QNetworkAccessManager(this); - connect(NMAN, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)) ); - connect(NMAN, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT(sslErrors(QNetworkReply*, const QList<QSslError>&)) ); - - setprefix = settingsPrefix; - syncTimer = new QTimer(this); - syncTimer->setInterval(300000); //5 minutes - connect(syncTimer, SIGNAL(timeout()), this, SLOT(checkTimes())); - syncTimer->start(); -} - -RSSReader::~RSSReader(){ - -} - -//Information retrieval -QStringList RSSReader::channels(){ - QStringList urls = hash.keys(); - QStringList ids; - //sort all the channels by title before output - for(int i=0; i<urls.length(); i++){ - QString title = hash[urls[i]].title; - if(title.isEmpty()){ title = "ZZZ"; } //put currently-invalid ones at the end of the list - ids << title+" : "+hash[urls[i]].originalURL; - } - ids.sort(); - //Now strip off all the titles again to just get the IDs - for(int i=0; i<ids.length(); i++){ - ids[i] = ids[i].section(" : ",-1); - } - return ids; -} - -RSSchannel RSSReader::dataForID(QString ID){ - QString key = keyForUrl(ID); - if(hash.contains(key)){ return hash[key]; } - else{ return RSSchannel(); } -} - -//Initial setup -void RSSReader::addUrls(QStringList urls){ - //qDebug() << "Add URLS:" << urls; - for(int i=0; i<urls.length(); i++){ - //Note: Make sure we get the complete URL form for accurate comparison later - QString url = QUrl(urls[i]).toString(); - QString key = keyForUrl(url); - if(hash.contains(key)){ continue; } //already handled - RSSchannel blank; - blank.originalURL = url; - hash.insert(url, blank); //put the empty struct into the hash for now - requestRSS(url); //startup the initial request for this url - } - emit newChannelsAvailable(); -} - -void RSSReader::removeUrl(QString ID){ - QString key = keyForUrl(ID); - if(hash.contains(key)){ hash.remove(key); } - emit newChannelsAvailable(); -} - -//================= -// PUBLIC SLOTS -//================= -void RSSReader::syncNow(){ - QStringList urls = hash.keys(); - for(int i=0; i<urls.length(); i++){ - requestRSS(hash[urls[i]].originalURL); - } -} - -//================= -// PRIVATE -//================= -QString RSSReader::keyForUrl(QString url){ - //get current hash key for this URL - QStringList keys = hash.keys(); - if(keys.contains(url)){ return url; } //this is already a valid key - for(int i=0; i<keys.length(); i++){ - if(hash[keys[i]].originalURL == url){ return keys[i]; } //this was an original URL - } - return ""; -} - -void RSSReader::requestRSS(QString url){ - if(!outstandingURLS.contains(url)){ - //qDebug() << "Request URL:" << url; - NMAN->get( QNetworkRequest( QUrl(url) ) ); - outstandingURLS << url; - } -} - -//RSS parsing functions -RSSchannel RSSReader::readRSS(QByteArray bytes){ - //Note: We could expand this later to support multiple "channel"s per Feed - // but it seems like there is normally only one channel anyway - //qDebug() << "Read RSS:" << bytes.left(100); - QXmlStreamReader xml(bytes); - RSSchannel rssinfo; - //qDebug() << "Can Read XML Stream:" << !xml.hasError(); - if(xml.readNextStartElement()){ - //qDebug() << " - RSS Element:" << xml.name(); - if(xml.name() == "rss" && (xml.attributes().value("version") =="2.0" || xml.attributes().value("version") =="0.91") ){ - while(xml.readNextStartElement()){ - //qDebug() << " - RSS Element:" << xml.name(); - if(xml.name()=="channel"){ rssinfo = readRSSChannel(&xml); } - else{ xml.skipCurrentElement(); } - } - } - } - if(xml.hasError()){ qDebug() << " - XML Read Error:" << xml.errorString() << "\n" << bytes; } - return rssinfo; -} -RSSchannel RSSReader::readRSSChannel(QXmlStreamReader *rss){ - RSSchannel info; - info.timetolive = -1; - while(rss->readNextStartElement()){ - //qDebug() << " - RSS Element (channel):" <<rss->name(); - if(rss->name()=="item"){ info.items << readRSSItem(rss); } - else if(rss->name()=="title"){ info.title = rss->readElementText(); } - else if(rss->name()=="link"){ - QString txt = rss->readElementText(); - if(!txt.isEmpty()){ info.link = txt; } - } - else if(rss->name()=="description"){ info.description = rss->readElementText(); } - else if(rss->name()=="lastBuildDate"){ info.lastBuildDate = RSSDateTime(rss->readElementText()); } - else if(rss->name()=="pubDate"){ info.lastPubDate = RSSDateTime(rss->readElementText()); } - else if(rss->name()=="image"){ readRSSImage(&info, rss); } - //else if(rss->name()=="skipHours"){ info.link = rss->readElementText(); } - //else if(rss->name()=="skipDays"){ info.link = rss->readElementText(); } - else if(rss->name()=="ttl"){ info.timetolive = rss->readElementText().toInt(); } - else{ rss->skipCurrentElement(); } - } - return info; -} - -RSSitem RSSReader::readRSSItem(QXmlStreamReader *rss){ - RSSitem item; - while(rss->readNextStartElement()){ - //qDebug() << " - RSS Element (Item):" << rss->name(); - if(rss->name()=="title"){ item.title = rss->readElementText(); } - else if(rss->name()=="link"){ item.link = rss->readElementText(); } - else if(rss->name()=="description"){ item.description = rss->readElementText(); } - else if(rss->name()=="comments"){ item.comments_url = rss->readElementText(); } - else if(rss->name()=="author"){ - //Special handling - this field can contain both email and name - QString raw = rss->readElementText(); - if(raw.contains("@")){ - item.author_email = raw.split(" ").filter("@").first(); - item.author = raw.remove(item.author_email).remove("(").remove(")").simplified(); //the name is often put within parentheses after the email - }else{ item.author = raw; } - } - else if(rss->name()=="guid"){ item.guid = rss->readElementText(); } - else if(rss->name()=="pubDate"){ item.pubdate = RSSDateTime(rss->readElementText()); } - else{ rss->skipCurrentElement(); } - } - return item; -} - -void RSSReader::readRSSImage(RSSchannel *item, QXmlStreamReader *rss){ - while(rss->readNextStartElement()){ - //qDebug() << " - RSS Element (Image):" << rss->name(); - if(rss->name()=="url"){ item->icon_url = rss->readElementText(); } - else if(rss->name()=="title"){ item->icon_title = rss->readElementText(); } - else if(rss->name()=="link"){ item->icon_link = rss->readElementText(); } - else if(rss->name()=="width"){ item->icon_size.setWidth(rss->readElementText().toInt()); } - else if(rss->name()=="height"){ item->icon_size.setHeight(rss->readElementText().toInt()); } - else if(rss->name()=="description"){ item->icon_description = rss->readElementText(); } - } - //Go ahead and kick off the request for the icon - if(!item->icon_url.isEmpty()){ requestRSS(item->icon_url); } -} - -QDateTime RSSReader::RSSDateTime(QString datetime){ - return QDateTime::fromString(datetime, Qt::RFC2822Date); -} - -//================= -// PRIVATE SLOTS -//================= -void RSSReader::replyFinished(QNetworkReply *reply){ - QString url = reply->request().url().toString(); - //qDebug() << "Got Reply:" << url; - QString key = keyForUrl(url); //current hash key for this URL - QByteArray data = reply->readAll(); - outstandingURLS.removeAll(url); - if(data.isEmpty()){ - //qDebug() << "No data returned:" << url; - //see if the URL can be adjusted for known issues - bool handled = false; - QUrl redirecturl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); - if(redirecturl.isValid() && (redirecturl.toString() != url )){ - //New URL redirect - make the change and send a new request - QString newurl = redirecturl.toString(); - //qDebug() << " - Redirect to:" << newurl; - if(hash.contains(key) && !hash.contains(newurl)){ - hash.insert(newurl, hash.take(key) ); //just move the data over to the new url - requestRSS(newurl); - emit newChannelsAvailable(); - handled = true; - } - } - if(!handled && hash.contains(key) ){ - emit rssChanged(hash[key].originalURL); - } - return; - } - - if(!hash.contains(key)){ - //qDebug() << " - hash does not contain URL:" << url; - //URL removed from list while a request was outstanding? - //Could also be an icon fetch response - QStringList keys = hash.keys(); - for(int i=0; i<keys.length(); i++){ - //qDebug() << " - Check for icon URL:" << hash[keys[i]].icon_url; - if(hash[keys[i]].icon_url.toLower() == url.toLower()){ //needs to be case-insensitive - //Icon fetch response - RSSchannel info = hash[keys[i]]; - QImage img = QImage::fromData(data); - info.icon = QIcon( QPixmap::fromImage(img) ); - //qDebug() << "Got Icon response:" << url << info.icon; - hash.insert(keys[i], info); //insert back into the hash - emit rssChanged( hash[keys[i]].originalURL ); - break; - } - } - reply->deleteLater(); - }else{ - //RSS reply - RSSchannel info = readRSS(data); //QNetworkReply can be used as QIODevice - reply->deleteLater(); //clean up - //Validate the info and announce any changes - if(info.title.isEmpty() || info.link.isEmpty() || info.description.isEmpty()){ - qDebug() << "Missing XML Information:" << url << info.title << info.link << info.description; - return; - } //bad info/read - //Update the bookkeeping elements of the info - if(info.timetolive<=0){ info.timetolive = LSession::handle()->DesktopPluginSettings()->value(setprefix+"default_interval_minutes", 60).toInt(); } - if(info.timetolive <=0){ info.timetolive = 60; } //error in integer conversion from settings? - info.lastsync = QDateTime::currentDateTime(); info.nextsync = info.lastsync.addSecs(info.timetolive * 60); - //Now see if anything changed and save the info into the hash - bool changed = (hash[key].lastBuildDate.isNull() || (hash[key].lastBuildDate < info.lastBuildDate) ); - bool newinfo = false; - if(changed){ newinfo = hash[key].title.isEmpty(); } //no previous info from this URL - info.originalURL = hash[key].originalURL; //make sure this info gets preserved across updates - if(!hash[key].icon.isNull()){ info.icon = hash[key].icon; } //copy over the icon from the previous reply - hash.insert(key, info); - if(newinfo){ emit newChannelsAvailable(); } //new channel - else if(changed){ emit rssChanged(info.originalURL); } //update to existing channel - } -} - -void RSSReader::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors){ - int ok = 0; - qDebug() << "SSL Errors Detected (RSS Reader):" << reply->url(); - for(int i=0; i<errors.length(); i++){ - if(errors[i].error()==QSslError::SelfSignedCertificate || errors[i].error()==QSslError::SelfSignedCertificateInChain){ ok++; } - else{ qDebug() << "Unhandled SSL Error:" << errors[i].errorString(); } - } - if(ok==errors.length()){ qDebug() << " - Permitted:" << reply->url(); reply->ignoreSslErrors(); } - else{ qDebug() << " - Denied:" << reply->url(); } -} - -void RSSReader::checkTimes(){ - if(LSession::handle()->DesktopPluginSettings()->value(setprefix+"manual_sync_only", false).toBool()){ return; } - QStringList urls = hash.keys(); - QDateTime cdt = QDateTime::currentDateTime(); - for(int i=0; i<urls.length(); i++){ - if(hash[urls[i]].nextsync < cdt){ requestRSS(urls[i]); } - } -} diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSObjects.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSObjects.h deleted file mode 100644 index 3069bf8d..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/rssreader/RSSObjects.h +++ /dev/null @@ -1,105 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2016, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_DESKTOP_RSS_READER_PLUGIN_OBJECT_H -#define _LUMINA_DESKTOP_RSS_READER_PLUGIN_OBJECT_H - -#include <QNetworkAccessManager> -#include <QNetworkReply> -#include <QString> -#include <QDateTime> -#include <QList> -#include <QIcon> -#include <QTimer> -#include <QXmlStreamReader> //Contained in the Qt "core" module - don't need the full "xml" module for this -#include <QSslError> - -struct RSSitem{ - //Required Fields - QString title, link, description; - - //Optional Fields - QString comments_url, author_email, author, guid; - QDateTime pubdate; //when the item was published - //IGNORED INFO from RSS2 spec: "category", "source", "enclosure" -}; - -struct RSSchannel{ - //Required fields - QString title, link, description; - - //Optional Fields - QDateTime lastBuildDate, lastPubDate; //last build/publish dates - // - channel refresh information - int timetolive; //in minutes - time until next sync should be performed - //QList<int> skiphours; - //QStringList skipdays; - // - icon info - QIcon icon; - QString icon_url, icon_title, icon_link, icon_description; - QSize icon_size; - //All items within this channel - QList<RSSitem> items; - - //Optional RSS2 elements ignored: - // "cloud", "textInput", "rating", "language", "copyright", "managingEditor", "webMaster", - // "category", "generator", "docs" - - //Internal data for bookkeeping - QDateTime lastsync, nextsync; - QString originalURL; //in case it was redirected to some "fixed" url later -}; - -class RSSReader : public QObject{ - Q_OBJECT -public: - RSSReader(QObject *parent, QString settingsPrefix); - ~RSSReader(); - - //Information retrieval - QStringList channels(); //returns all ID's - RSSchannel dataForID(QString ID); - - //Initial setup - void addUrls(QStringList urls); - void removeUrl(QString ID); - -public slots: - void syncNow(); //not generally needed - -private: - //Internal data objects - QHash<QString, RSSchannel> hash; // ID/data - QString setprefix; - QTimer *syncTimer; - QNetworkAccessManager *NMAN; - QStringList outstandingURLS; - - - //Simple hash data search functions - QString keyForUrl(QString url); - - //Network request function - void requestRSS(QString url); - - //RSS parsing functions - RSSchannel readRSS(QByteArray bytes); - RSSchannel readRSSChannel(QXmlStreamReader *rss); - RSSitem readRSSItem(QXmlStreamReader *rss); - void readRSSImage(RSSchannel *item, QXmlStreamReader *rss); - QDateTime RSSDateTime(QString datetime); - -private slots: - void replyFinished(QNetworkReply *reply); - void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors); - void checkTimes(); - -signals: - void rssChanged(QString); //ID - void newChannelsAvailable(); -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.cpp b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.cpp deleted file mode 100644 index 951bcc98..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "MonitorWidget.h" -#include "ui_MonitorWidget.h" - - -#include <LuminaXDG.h> -#include <LuminaOS.h> - -MonitorWidget::MonitorWidget(QWidget *parent) : QWidget(parent), ui(new Ui::MonitorWidget()){ - ui->setupUi(this); //load the designer form - upTimer = new QTimer(this); - upTimer->setInterval(2000); //update every 2 seconds - connect(upTimer, SIGNAL(timeout()), this, SLOT(UpdateStats()) ); - LoadIcons(); - upTimer->start(); -} - -MonitorWidget::~MonitorWidget(){ - //qDebug() << "Removing MonitorWidget"; -} - -void MonitorWidget::LoadIcons(){ - ui->tabWidget->setTabIcon(0,LXDG::findIcon("appointment-recurring","") ); //Summary - ui->tabWidget->setTabIcon(1,LXDG::findIcon("drive-harddisk","") ); //Disk Usage - //ui->tabWidget->setTabIcon(1,LXDG::findIcon("cpu","") ); //CPU Log - //ui->tabWidget->setTabIcon(2,LXDG::findIcon("media-flash-memory-stick","") ); //Mem Log -} - -void MonitorWidget::UpdateStats(){ - //qDebug() << "Updating System statistics..."; - ui->label_temps->setText( LOS::CPUTemperatures().join(", ") ); - if(ui->progress_cpu->isEnabled()){ - int perc = LOS::CPUUsagePercent(); - ui->progress_cpu->setValue(perc); - if(perc<0){ ui->progress_cpu->setEnabled(false); } //disable this for future checks - } - if(ui->progress_mem->isEnabled()){ - int perc = LOS::MemoryUsagePercent(); - ui->progress_mem->setValue(perc); - if(perc<0){ ui->progress_mem->setEnabled(false); } //disable this for future checks - } - ui->label_diskinfo->setText( LOS::DiskUsage().join("\n") ); - //Also perform/update the logs as necessary - // -- TO DO -- -} - -SysMonitorPlugin::SysMonitorPlugin(QWidget *parent, QString ID) : LDPlugin(parent, ID){ - monitor = new MonitorWidget(this); - this->setLayout( new QVBoxLayout() ); - this->layout()->setContentsMargins(0,0,0,0); - this->layout()->addWidget(monitor); - - //this->setInitialSize(monitor->sizeHint().width(),monitor->sizeHint().height()); -} - -SysMonitorPlugin::~SysMonitorPlugin(){ - //qDebug() << "Remove SysMonitorPlugin"; -}
\ No newline at end of file diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.h b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.h deleted file mode 100644 index 618ac8f4..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.h +++ /dev/null @@ -1,62 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This plugin is a simple hardware status monitor on the desktop -//=========================================== -#ifndef _LUMINA_DESKTOP_PLUGIN_HW_MONITOR_WIDGET_H -#define _LUMINA_DESKTOP_PLUGIN_HW_MONITOR_WIDGET_H - -#include <QTimer> -#include <QWidget> - -#include "../LDPlugin.h" - -namespace Ui{ - class MonitorWidget; -}; - -class MonitorWidget : public QWidget{ - Q_OBJECT -public: - MonitorWidget(QWidget *parent = 0); - ~MonitorWidget(); - -public slots: - void LoadIcons(); - -private: - Ui::MonitorWidget *ui; - QTimer *upTimer; - -private slots: - void UpdateStats(); -}; - -// Wrapper class to put this into a desktop plugin container -class SysMonitorPlugin : public LDPlugin{ - Q_OBJECT -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(3,2); - } - -private: - MonitorWidget *monitor; - -public slots: - void LocaleChange(){ - QTimer::singleShot(0,monitor, SLOT(LoadIcons())); - } - void ThemeChange(){ - QTimer::singleShot(0,monitor, SLOT(LoadIcons())); - } -}; - -#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.ui b/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.ui deleted file mode 100644 index 8798bc25..00000000 --- a/src-qt5/core/lumina-desktop-unified/src-DE/desktop-plugins/systemmonitor/MonitorWidget.ui +++ /dev/null @@ -1,143 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MonitorWidget</class> - <widget class="QWidget" name="MonitorWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>300</width> - <height>122</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab_summary"> - <attribute name="title"> - <string>Summary</string> - </attribute> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>CPU Temp:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_temps"> - <property name="text"> - <string notr="true"/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>CPU Usage:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QProgressBar" name="progress_cpu"> - <property name="value"> - <number>0</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Mem Usage:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QProgressBar" name="progress_mem"> - <property name="value"> - <number>0</number> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_disks"> - <attribute name="title"> - <string>Disk I/O</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QScrollArea" name="scrollArea"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>292</width> - <height>89</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QLabel" name="label_diskinfo"> - <property name="text"> - <string notr="true"/> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> |