From 87feee74433c3e4404494c3196c89ca41df0bdea Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 5 Mar 2015 14:20:32 -0500 Subject: Adjust the panel settings adjustment routine a bit more. Now it will no longer activate the save button when changing tabs on a panel. --- lumina-config/mainUI.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index 724d4556..34b25b3d 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -868,8 +868,13 @@ void MainUI::adjustpanel1(){ if(loading || panadjust){ return; } panadjust = true; qDebug() << "Adjust Panel 1:"; - ui->toolBox_panel1->setCurrentIndex( ui->toolBox_panel2->currentIndex() ); - bool changed = false; + bool valchanged = ui->toolBox_panel1->currentIndex()==ui->toolBox_panel2->currentIndex(); + if(!valchanged){ + //Just a toolbox page change - switch to match and exit + ui->toolBox_panel1->setCurrentIndex( ui->toolBox_panel2->currentIndex() ); + panadjust = false; + return; + } int newindex=0; switch(ui->combo_panel2_loc->currentIndex()){ case 0: @@ -882,11 +887,11 @@ void MainUI::adjustpanel1(){ newindex = 2; break; } if(newindex != ui->combo_panel1_loc->currentIndex()){ - changed = true; + valchanged = true; ui->combo_panel1_loc->setCurrentIndex(newindex); } panadjust = false; - if(!loading){ ui->push_save->setEnabled(true); modpan = true; } + if(!loading && valchanged){ ui->push_save->setEnabled(true); modpan = true; } } void MainUI::adjustpanel2(){ @@ -894,8 +899,14 @@ void MainUI::adjustpanel2(){ panadjust = true; //Adjust panel 2 to complement a panel 1 change qDebug() << "Adjust Panel 2:"; - ui->toolBox_panel2->setCurrentIndex( ui->toolBox_panel1->currentIndex() ); - bool changed = false; + bool valchanged = ui->toolBox_panel1->currentIndex()==ui->toolBox_panel2->currentIndex(); + if(!valchanged){ + //Just a toolbox page change - switch to match and exit + ui->toolBox_panel2->setCurrentIndex( ui->toolBox_panel1->currentIndex() ); + panadjust = false; + return; + } + int newindex=0; switch(ui->combo_panel1_loc->currentIndex()){ case 0: @@ -908,11 +919,11 @@ void MainUI::adjustpanel2(){ newindex = 2; break; } if(newindex != ui->combo_panel2_loc->currentIndex()){ - changed = true; + valchanged = true; ui->combo_panel2_loc->setCurrentIndex(newindex); } panadjust = false; - if(!loading && changed){ ui->push_save->setEnabled(true); modpan = true; } + if(!loading && valchanged){ ui->push_save->setEnabled(true); modpan = true; } } -- cgit From 2a43d04950e1c7c364b03fe5552e2d687b8845b0 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 25 Mar 2015 12:45:49 -0400 Subject: Add my "work-in-progress" on lumina-wm (screensaver implementation so far) to GIt. This is *not* ready to be built, much less used yet. --- lumina-wm/LScreenSaver.cpp | 97 +++++++++++++++++++++++++++++++++++++++++ lumina-wm/LScreenSaver.h | 43 ++++++++++++++++++ lumina-wm/WMSession.h | 40 +++++++++++++++++ lumina-wm/lumina-wm.pro | 106 +++++++++++++++++++++++++++++++++++++++++++++ lumina-wm/main.cpp | 40 +++++++++++++++++ 5 files changed, 326 insertions(+) create mode 100644 lumina-wm/LScreenSaver.cpp create mode 100644 lumina-wm/LScreenSaver.h create mode 100644 lumina-wm/WMSession.h create mode 100644 lumina-wm/lumina-wm.pro create mode 100644 lumina-wm/main.cpp diff --git a/lumina-wm/LScreenSaver.cpp b/lumina-wm/LScreenSaver.cpp new file mode 100644 index 00000000..7af3758f --- /dev/null +++ b/lumina-wm/LScreenSaver.cpp @@ -0,0 +1,97 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "LScreenSaver.h" + +LScreenSaver::LScreenSaver(){ + starttimer = new QTimer(this); + starttimer->setSingleShot(true); + locktimer = new QTimer(this); + locktimer->setSingleShot(true); + hidetimer = new QTimer(this); + hidetimer->setSingleShot(true); + + settings = new QSettings("LuminaDE","lumina-screensaver",this); + SSRunning = SSLocked = false; + + connect(starttimer, SIGNAL(timeout()), this, SLOT(ShowScreenSaver()) ); +} + +LScreenSaver::~LScreenSaver(){ + +} + +// =========== +// PUBLIC SLOTS +// =========== +void LScreenSaver::start(){ + reloadSettings(); //setup all the initial time frames + +} + +void LScreenSaver::reloadSettings(){ + settings->sync(); + starttimer->setInterval( settings.value("timedelaymin",10).toInt() * 60000 ); + locktimer->setInterval( settings.value("lockdelaymin",1).toInt() * 60000 ); + hidetimer->setInterval( settings.value("hidesecs",15).toInt() * 1000 ); +} + +void LScreenSaver::newInputEvent(){ + //First stop any timers that are running + if(starttimer->isActive()){ starttimer->stop();} + if(locktimer->isActive()){ locktimer->stop(); } + if(hidetimer->isActive()){ hidetimer->stop(); } + + if(SSRunning && SSLocked){ + //Running and locked + // Hide the running setting, and display the lock screen + + //Start the timer for restarting the SS and hiding the lockscreen + hidetimer->start(); + + }else if(SSRunning){ + //Only running, not locked + //De-activate the screensaver and start the main timer + HideScreenSaver(); + starttimer->start(); + + }else if(SSLocked){ + //Only locked, not running + hidetimer->start(); //restart the time to hide the lock screen + + }else{ + //Neither running nor locked + if( settings.value("timedelaymin",10).toInt() > 0 ){ starttimer->start(); } + } + +} + +// =========== +// PRIVATE SLOTS +// =========== +void LScreenSaver::ShowScreenSaver(){ + + SSRunning = true; + //Start the lock timer if necessary + if(!SSLocked && (settings.value("lockdelaymin",10).toInt()>0) ){ locktimer->start(); } +} + +void LScreenSaver::ShowLockScreen(){ + + SSLocked = true; + //Start the timer for hiding the lock screen due to inactivity + if(settings.value("hidesecs",15).toInt() > 0 ){ hidetimer->start(); } +} + +void LScreenSaver::HideScreenSaver(){ + + SSRunning = false; +} + +void LScreenSaver::HideLockScreen(){ + + //Leave the Locked flag set (still locked, just not visible) +} diff --git a/lumina-wm/LScreenSaver.h b/lumina-wm/LScreenSaver.h new file mode 100644 index 00000000..c2965ae6 --- /dev/null +++ b/lumina-wm/LScreenSaver.h @@ -0,0 +1,43 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_DESKTOP_SCREEN_SAVER_H +#define _LUMINA_DESKTOP_SCREEN_SAVER_H + +#include +#include +#include +#include + +class LScreenSaver : public QObject{ + Q_OBJECT +public: + LScreenSaver(); + ~LScreenSaver(); + +private: + QTimer *starttimer, *locktimer, *hidetimer; + QSettings *settings; + bool SSRunning, SSLocked; + +public slots: + void start(); + void reloadSettings(); + void newInputEvent(); + +private slots: + void ShowScreenSaver(); + void ShowLockScreen(); + void HideScreenSaver(); + void HideLockScreen(); + +signals: + void StartingScreenSaver(); + void ClosingScreenSaver(); + +}; + +#endif \ No newline at end of file diff --git a/lumina-wm/WMSession.h b/lumina-wm/WMSession.h new file mode 100644 index 00000000..a1212af5 --- /dev/null +++ b/lumina-wm/WMSession.h @@ -0,0 +1,40 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_DESKTOP_WINDOW_MANAGER_SESSION_H +#define _LUMINA_DESKTOP_WINDOW_MANAGER_SESSION_H + +#include +#include + +#include "LScreenSaver.h" + +class WMSession : public QObject{ + Q_OBJECT +public: + WMSession(); + ~WMSession(); + + void start(); + +private: + //XCB Event Watcher + + //ScreenSaver + LScreenSaver *SS; + + //Window Manager + + +public slots: + void reloadIcons(); + void newInputsAvailable(QStringList); + +private slots: + +}; + +#endif \ No newline at end of file diff --git a/lumina-wm/lumina-wm.pro b/lumina-wm/lumina-wm.pro new file mode 100644 index 00000000..34d8a9ac --- /dev/null +++ b/lumina-wm/lumina-wm.pro @@ -0,0 +1,106 @@ + +QT += core gui network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras + +TARGET = lumina-wm +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/bin + +isEmpty(LIBPREFIX) { + LIBPREFIX = $$PREFIX/lib +} + +LIBS += -L../libLumina -L$$LIBPREFIX -lLuminaUtils -lXdamage -lX11 -lxcb -lxcb-damage +QMAKE_LIBDIR = ../libLumina +DEPENDPATH += ../libLumina + +TEMPLATE = app + +isEmpty(QT5LIBDIR) { + QT5LIBDIR = $$PREFIX/lib/qt5 +} + +LRELEASE = $$QT5LIBDIR/bin/lrelease + + +SOURCES += main.cpp \ + WMSession.cpp \ + LScreenSaver.cpp + + +HEADERS += WMSession.h \ + LScreenSaver.h + +FORMS += + +INCLUDEPATH += ../libLumina $$PREFIX/include + +TRANSLATIONS = i18n/lumina-wm_af.ts \ + i18n/lumina-wm_ar.ts \ + i18n/lumina-wm_az.ts \ + i18n/lumina-wm_bg.ts \ + i18n/lumina-wm_bn.ts \ + i18n/lumina-wm_bs.ts \ + i18n/lumina-wm_ca.ts \ + i18n/lumina-wm_cs.ts \ + i18n/lumina-wm_cy.ts \ + i18n/lumina-wm_da.ts \ + i18n/lumina-wm_de.ts \ + i18n/lumina-wm_el.ts \ + i18n/lumina-wm_en_GB.ts \ + i18n/lumina-wm_en_ZA.ts \ + i18n/lumina-wm_es.ts \ + i18n/lumina-wm_et.ts \ + i18n/lumina-wm_eu.ts \ + i18n/lumina-wm_fa.ts \ + i18n/lumina-wm_fi.ts \ + i18n/lumina-wm_fr.ts \ + i18n/lumina-wm_fr_CA.ts \ + i18n/lumina-wm_gl.ts \ + i18n/lumina-wm_he.ts \ + i18n/lumina-wm_hi.ts \ + i18n/lumina-wm_hr.ts \ + i18n/lumina-wm_hu.ts \ + i18n/lumina-wm_id.ts \ + i18n/lumina-wm_is.ts \ + i18n/lumina-wm_it.ts \ + i18n/lumina-wm_ja.ts \ + i18n/lumina-wm_ka.ts \ + i18n/lumina-wm_ko.ts \ + i18n/lumina-wm_lt.ts \ + i18n/lumina-wm_lv.ts \ + i18n/lumina-wm_mk.ts \ + i18n/lumina-wm_mn.ts \ + i18n/lumina-wm_ms.ts \ + i18n/lumina-wm_mt.ts \ + i18n/lumina-wm_nb.ts \ + i18n/lumina-wm_nl.ts \ + i18n/lumina-wm_pa.ts \ + i18n/lumina-wm_pl.ts \ + i18n/lumina-wm_pt.ts \ + i18n/lumina-wm_pt_BR.ts \ + i18n/lumina-wm_ro.ts \ + i18n/lumina-wm_ru.ts \ + i18n/lumina-wm_sk.ts \ + i18n/lumina-wm_sl.ts \ + i18n/lumina-wm_sr.ts \ + i18n/lumina-wm_sv.ts \ + i18n/lumina-wm_sw.ts \ + i18n/lumina-wm_ta.ts \ + i18n/lumina-wm_tg.ts \ + i18n/lumina-wm_th.ts \ + i18n/lumina-wm_tr.ts \ + i18n/lumina-wm_uk.ts \ + i18n/lumina-wm_uz.ts \ + i18n/lumina-wm_vi.ts \ + i18n/lumina-wm_zh_CN.ts \ + i18n/lumina-wm_zh_HK.ts \ + i18n/lumina-wm_zh_TW.ts \ + i18n/lumina-wm_zu.ts + +dotrans.path=$$PREFIX/share/Lumina-DE/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/ + +INSTALLS += target dotrans diff --git a/lumina-wm/main.cpp b/lumina-wm/main.cpp new file mode 100644 index 00000000..b19b00e3 --- /dev/null +++ b/lumina-wm/main.cpp @@ -0,0 +1,40 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2015, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include + +#include +#include +#include +#include +#include + + +#include "WMSession.h" + +#include //from libLuminaUtils +#include +#include + +//#define DEBUG 0 + +int main(int argc, char ** argv) +{ + LSingleApplication a(argc, argv, "lumina-wm"); + if(!a.isPrimaryProcess()){ return 0; } //Inputs forwarded on to the primary already + LuminaThemeEngine themes(&a); + + //Setup the special settings prefix location + QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); + + WMSession w; + w.start(); + QObject::connect(themes, SIGNAL(updateIcons()), &w, SLOT(reloadIcons()) ); + QObject::connect(a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(newInputsAvailable(QStringList)) ); + int retCode = a.exec(); + + return retCode; +} -- cgit From f8ae4fcc57e5c4020646a0237c0279b2bd0e1780 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 26 Mar 2015 10:23:14 -0400 Subject: Clean up a couple things in lumina-fm: 1) Fix the double-run of the background dir checker when changing directories. 2) Add the file overwrite checks to the cut procedures in the backend. 3) If a file/dir is copied onto itself, just skip it rather than erroring. --- lumina-fm/FODialog.cpp | 20 ++++++++++++++++++-- lumina-fm/MainUI.cpp | 7 +++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lumina-fm/FODialog.cpp b/lumina-fm/FODialog.cpp index 165733e3..416404ee 100644 --- a/lumina-fm/FODialog.cpp +++ b/lumina-fm/FODialog.cpp @@ -219,6 +219,7 @@ QStringList FOWorker::removeItem(QString path, bool recursive){ QStringList FOWorker::copyItem(QString oldpath, QString newpath){ QStringList err; + if(oldpath == newpath){ return err; } //copy something onto itself - just skip it if(QFileInfo(oldpath).isDir()){ //Create a new directory with the same name (no way to copy dir+contents) QDir dir; @@ -287,6 +288,12 @@ void FOWorker::slotStartOperations(){ QStringList err; err << tr("Invalid Move") << QString(tr("It is not possible to move a directory into itself. Please make a copy of the directory instead.\n\nOld Location: %1\nNew Location: %2")).arg(ofiles[i], nfiles[i]); emit finished(err); return; }else{ + //Check for existance of the new name + if(QFile::exists(nfiles[i])){ + if(!overwrite){ + nfiles[i] = newFileName(nfiles[i]); //prompt for new file name up front before anything starts + } + } //no changes necessary olist << ofiles[i]; nlist << nfiles[i]; @@ -319,8 +326,17 @@ void FOWorker::slotStartOperations(){ /*ui->label->setText( QString(tr("Moving: %1 to %2")).arg(ofiles[i].section("/",-1), nfiles[i].section("/",-1)) ); QApplication::processEvents();*/ emit startingItem(i+1,olist.length(), olist[i], nlist[i]); - if( !QFile::rename(ofiles[i], nfiles[i]) ){ - errlist << ofiles[i]; + //Clean up any overwritten files/dirs + if(QFile::exists(nlist[i])){ + if(overwrite){ + errlist << removeItem(nlist[i], true); //recursively remove the file/dir since we are supposed to overwrite it + } + } + //Perform the move if no error yet (including skipping all children) + if( !errlist.contains(olist[i].section("/",0,-1)) ){ + if( !QFile::rename(ofiles[i], nfiles[i]) ){ + errlist << ofiles[i]; + } } } //ui->progressBar->setValue(i+1); diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index fa892dfd..9d66bc36 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -442,9 +442,11 @@ void MainUI::setCurrentDir(QString dir){ ui->tool_goToPlayer->setVisible(false); ui->tool_goToRestore->setVisible(false); ui->tool_goToImages->setVisible(false); - //if(olddir!=rawdir){ + //Make sure the shortcut buttons are enabled as necessary + // If the dir is already loaded into the fsmodel cache it will not emit the directoryLoaded() signal + if(rawdir == olddir){ emit DirChanged(rawdir); //This will be automatically run when a new dir is loaded - //} + } if(isUserWritable){ ui->label_dir_stats->setText(""); } else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } ui->tool_addToDir->setVisible(isUserWritable); @@ -825,6 +827,7 @@ void MainUI::reloadDirectory(){ void MainUI::currentDirectoryLoaded(){ //The directory was just loaded: refresh the action buttons as neccesary + // NOTE: This is only "caught" when a *new* directory is loaded into the model ui->tool_goToPlayer->setVisible(false); ui->tool_goToRestore->setVisible(false); ui->tool_goToImages->setVisible(false); -- cgit From 394aa3097fe504edce814454315d4dd533b4c5e6 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 26 Mar 2015 10:29:02 -0400 Subject: Actually move the file/dir copy onto itself check earlier in the procedure, that way we can't run into the situation where the dir is removed because of the conflicting destination. --- lumina-fm/FODialog.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lumina-fm/FODialog.cpp b/lumina-fm/FODialog.cpp index 416404ee..d182ed06 100644 --- a/lumina-fm/FODialog.cpp +++ b/lumina-fm/FODialog.cpp @@ -269,6 +269,10 @@ void FOWorker::slotStartOperations(){ if(isRM){ //only old files olist << subfiles(ofiles[i], false); //dirs need to be last for removals }else if(isCP || isRESTORE){ + if(nfiles[i] == ofiles[i]){ + //Trying to copy a file/dir to itself - skip it + continue; + } if(QFile::exists(nfiles[i])){ if(!overwrite){ nfiles[i] = newFileName(nfiles[i]); //prompt for new file name up front before anything starts -- cgit