diff options
author | Christopher Roy Bratusek <nano@jpberlin.de> | 2014-11-07 18:29:56 +0100 |
---|---|---|
committer | Christopher Roy Bratusek <nano@jpberlin.de> | 2014-11-07 18:29:56 +0100 |
commit | 29ced6bf8dfa6780fc188192cfdc36ea6315cce8 (patch) | |
tree | 33848aa946ad6a5b0b5d4ad5b4f9039c5f046da0 /lumina-desktop | |
parent | Merge remote-tracking branch 'upstream/master' (diff) | |
parent | Streamline the file manager quite a bit by putting the long-lived checks in a... (diff) | |
download | lumina-29ced6bf8dfa6780fc188192cfdc36ea6315cce8.tar.gz lumina-29ced6bf8dfa6780fc188192cfdc36ea6315cce8.tar.bz2 lumina-29ced6bf8dfa6780fc188192cfdc36ea6315cce8.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 45 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/NewDP.h | 3 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp | 4 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp | 106 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h | 52 | ||||
-rw-r--r-- | lumina-desktop/fluxboxconf/fluxbox-keys | 2 | ||||
-rw-r--r-- | lumina-desktop/lumina-desktop.pro | 6 | ||||
-rw-r--r-- | lumina-desktop/main.cpp | 2 |
8 files changed, 173 insertions, 47 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 556b4560..d51e423a 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -16,54 +16,17 @@ LDesktop::LDesktop(int deskNum) : QObject(){ DPREFIX = "desktop-"+QString::number(deskNum)+"/"; desktopnumber = deskNum; desktop = QApplication::desktop(); - //connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int))); defaultdesktop = (desktop->screenGeometry(desktopnumber).x()==0); desktoplocked = true; issyncing = bgupdating = deskupdating = false; - /*qDebug() << "Desktop #"<<deskNum<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height(); - deskMenu = new QMenu(0); - connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) ); - winMenu = new QMenu(0); - winMenu->setTitle(tr("Window List")); - winMenu->setIcon( LXDG::findIcon("preferences-system-windows","") );*/ usewinmenu=false; - //connect(winMenu, SIGNAL(triggered(QAction*)), this, SLOT(winClicked(QAction*)) ); - //appmenu = new AppMenu(0); - /*workspacelabel = new QLabel(0); - workspacelabel->setAlignment(Qt::AlignCenter); - wkspaceact = new QWidgetAction(0); - wkspaceact->setDefaultWidget(workspacelabel);*/ + //Setup the internal variables settings = new QSettings(QSettings::UserScope, "LuminaDE","desktopsettings", this); //qDebug() << " - Desktop Settings File:" << settings->fileName(); if(!QFile::exists(settings->fileName())){ settings->setValue(DPREFIX+"background/filelist",QStringList()<<"default"); settings->sync(); } bgWindow = 0; bgDesktop = 0; - - /*bgtimer = new QTimer(this); - bgtimer->setSingleShot(true); - connect(bgtimer, SIGNAL(timeout()), this, SLOT(UpdateBackground()) ); - watcher = new QFileSystemWatcher(this); - //connect(LSession::instance(), SIGNAL(DesktopConfigChanged()), this, SLOT(SettingsChanged()) ); - watcher->addPath(settings->fileName()); - connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(SettingsChanged()) ); - - bgWindow = new QWidget(0); - bgWindow->setObjectName("bgWindow"); - bgWindow->setContextMenuPolicy(Qt::CustomContextMenu); - LX11::SetAsDesktop(bgWindow->winId()); - bgWindow->setGeometry(desktop->screenGeometry(desktopnumber)); - connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) ); - bgDesktop = new QMdiArea(bgWindow); - //Make sure the desktop area is transparent to show the background - bgDesktop->setBackground( QBrush(Qt::NoBrush) ); - bgDesktop->setStyleSheet( "QMdiArea{ border: none; background: transparent;}" ); - - //Start the update processes - QTimer::singleShot(1,this, SLOT(UpdateMenu()) ); - QTimer::singleShot(1,this, SLOT(UpdateBackground()) ); - QTimer::singleShot(1,this, SLOT(UpdateDesktop()) ); - QTimer::singleShot(10,this, SLOT(UpdatePanels()) );*/ QTimer::singleShot(1,this, SLOT(InitDesktop()) ); } @@ -168,10 +131,10 @@ void LDesktop::InitDesktop(){ bgDesktop->setStyleSheet( "QMdiArea{ border: none; background: transparent;}" ); qDebug() << " - Desktop Init Done:" << desktopnumber; //Start the update processes - QTimer::singleShot(1,this, SLOT(UpdateMenu()) ); - QTimer::singleShot(1,this, SLOT(UpdateBackground()) ); + QTimer::singleShot(10,this, SLOT(UpdateMenu()) ); + QTimer::singleShot(0,this, SLOT(UpdateBackground()) ); QTimer::singleShot(1,this, SLOT(UpdateDesktop()) ); - QTimer::singleShot(10,this, SLOT(UpdatePanels()) ); + QTimer::singleShot(2,this, SLOT(UpdatePanels()) ); } void LDesktop::SettingsChanged(){ diff --git a/lumina-desktop/desktop-plugins/NewDP.h b/lumina-desktop/desktop-plugins/NewDP.h index daf9802c..6490af00 100644 --- a/lumina-desktop/desktop-plugins/NewDP.h +++ b/lumina-desktop/desktop-plugins/NewDP.h @@ -17,6 +17,7 @@ #include "calendar/CalendarPlugin.h" #include "applauncher/AppLauncherPlugin.h" #include "desktopview/DesktopViewPlugin.h" +#include "notepad/NotepadPlugin.h" class NewDP{ public: @@ -31,6 +32,8 @@ public: 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{ qWarning() << "Invalid Desktop Plugin:"<<plugin << " -- Ignored"; } diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp index 98d132ac..54727a36 100644 --- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp +++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp @@ -18,9 +18,8 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par list->setSpacing(2); list->setSelectionBehavior(QAbstractItemView::SelectItems); list->setSelectionMode(QAbstractItemView::NoSelection); - list->setStyleSheet( "QListWidget{ background: transparent; }" ); + list->setStyleSheet( "QListWidget{ background: rgba(255,255,255,100); border: none; border-radius: 3px;}" ); list->setIconSize(QSize(64,64)); - list->setGridSize(QSize(80,80)); this->layout()->addWidget(list); this->setInitialSize(200,300); watcher = new QFileSystemWatcher(this); @@ -41,6 +40,7 @@ void DesktopViewPlugin::runItem(QListWidgetItem *item){ void DesktopViewPlugin::updateContents(){ list->clear(); + list->setGridSize(QSize(80,70+this->fontMetrics().height())); 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++){ diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp new file mode 100644 index 00000000..01e7179e --- /dev/null +++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp @@ -0,0 +1,106 @@ +#include "NotepadPlugin.h" + +#include <LuminaXDG.h> +#include "LSession.h" + + +NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ + 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->setStyleSheet("QFrame{border-size: 1px; background: rgba(255,255,255,100); color: black;}"); + this->layout()->addWidget(frame); + frame->setLayout(vlay); + + //Setup the title bar header buttons + QHBoxLayout *hlay = new QHBoxLayout(); + next = new QToolButton(this); + prev = new QToolButton(this); + add = new QToolButton(this); + rem = new QToolButton(this); + label = new QLabel(this); + label->setAlignment(Qt::AlignCenter); + hlay->addWidget(prev); + hlay->addWidget(next); + hlay->addWidget(label); + hlay->addWidget(add); + hlay->addWidget(rem); + vlay->addLayout(hlay); + + //Setup the main text widget + edit = new QPlainTextEdit(this); + edit->setReadOnly(false); + vlay->addWidget(edit); + + //Now setup the initial values + cnote = this->settings->value("currentNote", 1).toInt(); + maxnote = this->settings->value("availableNotes",1).toInt(); + this->setInitialSize(200,300); + //Setup the button connections + connect(next, SIGNAL(clicked()), this, SLOT(nextNote()) ); + connect(prev, SIGNAL(clicked()), this, SLOT(prevNote()) ); + connect(add, SIGNAL(clicked()), this, SLOT(newNote()) ); + connect(rem, SIGNAL(clicked()), this, SLOT(remNote()) ); + connect(edit, SIGNAL(textChanged()), this, SLOT(noteChanged()) ); + QTimer::singleShot(0,this, SLOT(loadIcons()) ); + QTimer::singleShot(0,this, SLOT(updateContents()) ); + +} + +NotePadPlugin::~NotePadPlugin(){ + +} + +void NotePadPlugin::nextNote(){ + cnote++; + if(cnote>maxnote){ cnote = 1; } //go to the first + updateContents(); +} + +void NotePadPlugin::prevNote(){ + cnote--; + if(cnote<1){ cnote = maxnote; } //go to the last + updateContents(); +} + +void NotePadPlugin::newNote(){ + maxnote++; + cnote = maxnote; + updateContents(); +} + +void NotePadPlugin::remNote(){ + //Clear the current note + settings->remove("Note-"+QString::number(cnote)); + //If the last note, also decrease the max number + if(cnote==maxnote && maxnote>1){ maxnote--; } + //Now go to the previous note + cnote--; + if(cnote<1){ cnote = maxnote; } + updateContents(); +} + +void NotePadPlugin::updateContents(){ + next->setEnabled(cnote<maxnote); + prev->setEnabled(cnote>1); + label->setText( QString(tr("Note #%1")).arg(QString::number(cnote)) ); + settings->setValue("currentNote", cnote); + settings->setValue("availableNotes", maxnote); + edit->setPlainText( settings->value("Note-"+QString::number(cnote), "").toString() ); +} + + +void NotePadPlugin::noteChanged(){ + //Save the current text + settings->setValue("Note-"+QString::number(cnote), edit->toPlainText()); +} + + +void NotePadPlugin::loadIcons(){ + next->setIcon( LXDG::findIcon("go-next-view","") ); + prev->setIcon( LXDG::findIcon("go-previous-view","") ); + add->setIcon( LXDG::findIcon("document-new","") ); + rem->setIcon( LXDG::findIcon("document-close","") ); +} diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h new file mode 100644 index 00000000..0a4311ed --- /dev/null +++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h @@ -0,0 +1,52 @@ +//=========================================== +// 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 <QLabel> +#include <QVBoxLayout> +#include <QTimer> +#include "../LDPlugin.h" + +class NotePadPlugin : public LDPlugin{ + Q_OBJECT +public: + NotePadPlugin(QWidget* parent, QString ID); + ~NotePadPlugin(); + +private: + QPlainTextEdit *edit; + QToolButton *next, *prev, *add, *rem; + QLabel *label; + QFrame *frame; + int cnote, maxnote; //current/max note + +private slots: + void nextNote(); + void prevNote(); + void newNote(); + void remNote(); + void updateContents(); + + void noteChanged(); + + void loadIcons(); + +public slots: + void LocaleChange(){ + QTimer::singleShot(0,this, SLOT(updateContents())); + } + void ThemeChange(){ + QTimer::singleShot(0,this, SLOT(loadIcons())); + } + +}; +#endif diff --git a/lumina-desktop/fluxboxconf/fluxbox-keys b/lumina-desktop/fluxboxconf/fluxbox-keys index 958a48c7..4d78efcb 100644 --- a/lumina-desktop/fluxboxconf/fluxbox-keys +++ b/lumina-desktop/fluxboxconf/fluxbox-keys @@ -73,7 +73,7 @@ Mod4 9 :Tab 9 Mod1 F1 :Exec xterm # open a dialog to run programs -Mod1 F2 :Exec fbrun +Mod1 F2 :Exec lumina-search # current window commands Mod1 F4 :Close diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro index 479a3e3c..8772b661 100644 --- a/lumina-desktop/lumina-desktop.pro +++ b/lumina-desktop/lumina-desktop.pro @@ -41,7 +41,8 @@ SOURCES += main.cpp \ panel-plugins/systemdashboard/LSysDashboard.cpp \ panel-plugins/systemdashboard/SysMenuQuick.cpp \ desktop-plugins/applauncher/AppLauncherPlugin.cpp \ - desktop-plugins/desktopview/DesktopViewPlugin.cpp + desktop-plugins/desktopview/DesktopViewPlugin.cpp \ + desktop-plugins/notepad/NotepadPlugin.cpp HEADERS += Globals.h \ @@ -76,7 +77,8 @@ HEADERS += Globals.h \ desktop-plugins/SamplePlugin.h \ desktop-plugins/calendar/CalendarPlugin.h \ desktop-plugins/applauncher/AppLauncherPlugin.h \ - desktop-plugins/desktopview/DesktopViewPlugin.h + desktop-plugins/desktopview/DesktopViewPlugin.h \ + desktop-plugins/notepad/NotepadPlugin.h FORMS += SystemWindow.ui \ panel-plugins/userbutton/UserWidget.ui \ diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp index 8c99a902..884e9441 100644 --- a/lumina-desktop/main.cpp +++ b/lumina-desktop/main.cpp @@ -82,7 +82,7 @@ int main(int argc, char ** argv) if(DEBUG){ qDebug() << "Load Locale:" << timer->elapsed(); } a.LoadLocale(QLocale().name()); //Start launching external applications - QTimer::singleShot(2000, &a, SLOT(launchStartupApps()) ); //wait a second first + QTimer::singleShot(2000, &a, SLOT(launchStartupApps()) ); //wait a couple seconds first if(DEBUG){ qDebug() << "Exec Time:" << timer->elapsed(); delete timer;} int retCode = a.exec(); //qDebug() << "Stopping the window manager"; |