diff options
-rw-r--r-- | lumina-config/mainUI.cpp | 27 | ||||
-rw-r--r-- | lumina-fm/FODialog.cpp | 24 | ||||
-rw-r--r-- | lumina-fm/MainUI.cpp | 11 | ||||
-rw-r--r-- | lumina-wm/LScreenSaver.cpp | 97 | ||||
-rw-r--r-- | lumina-wm/LScreenSaver.h | 43 | ||||
-rw-r--r-- | lumina-wm/WMSession.h | 40 | ||||
-rw-r--r-- | lumina-wm/lumina-wm.pro | 106 | ||||
-rw-r--r-- | lumina-wm/main.cpp | 40 |
8 files changed, 374 insertions, 14 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index 8bcb4f40..744d4bdf 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -901,8 +901,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: @@ -915,11 +920,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(){ @@ -927,8 +932,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: @@ -941,11 +952,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; } } diff --git a/lumina-fm/FODialog.cpp b/lumina-fm/FODialog.cpp index 165733e3..d182ed06 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; @@ -268,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 @@ -287,6 +292,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 +330,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 59cb09bf..c4b74dbd 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -448,10 +448,12 @@ 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 - emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), rawdir, tr("Items")); - //} + } + emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), rawdir, tr("Items")); if(isUserWritable){ ui->label_dir_stats->setText(""); } else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } @@ -549,7 +551,7 @@ void MainUI::AvailableBackups(QString basedir, QStringList snapdirs){ } void MainUI::DisplayStatusBar(QString msg){ - qDebug() << "in main thread:" << msg; + qDebug() << "message to show in the status bar:" << msg; ui->statusbar->showMessage(msg); } @@ -839,6 +841,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); 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 <QObject> +#include <QStringList> +#include <QTimer> +#include <QSettings> + +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 <QObject> +#include <QStringList> + +#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 <QDebug> + +#include <QFile> +#include <QDir> +#include <QString> +#include <QTextStream> +#include <QUrl> + + +#include "WMSession.h" + +#include <LuminaXDG.h> //from libLuminaUtils +#include <LuminaThemes.h> +#include <LuminaSingleApplication.h> + +//#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; +} |