From 1db0f0125a34c30465586c102fe7c618bb196f87 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 4 Oct 2016 11:21:36 -0400 Subject: Fis the stylesheet for the "active/non-active" treewidget browser. --- src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp index e007b974..1112f971 100644 --- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp +++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp @@ -136,9 +136,9 @@ QStringList BrowserWidget::history(){ } void BrowserWidget::setShowActive(bool show){ - if(!show){ this->setStyleSheet("QAbstractScrollArea{ background-color: rgba(10,10,10,10); }"); } + if(!show){ this->setStyleSheet("QAbstractScrollArea{ background-color: rgba(10,10,10,10); } QHeaderView{ background-color: lightgrey; }"); } else{ - this->setStyleSheet( "QAbstractScrollArea{ background-color: white; }"); + this->setStyleSheet( ""); } } -- cgit From 8dc16d620364c8cd38cabcb3d505bcee5ff7b713 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 4 Oct 2016 14:45:51 -0400 Subject: Try to fix a scaling issue with desktop backgrounds on 4K systems. --- src-qt5/core/lumina-desktop/LDesktopBackground.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src-qt5/core/lumina-desktop/LDesktopBackground.cpp b/src-qt5/core/lumina-desktop/LDesktopBackground.cpp index dadbd848..3d33db71 100644 --- a/src-qt5/core/lumina-desktop/LDesktopBackground.cpp +++ b/src-qt5/core/lumina-desktop/LDesktopBackground.cpp @@ -38,7 +38,8 @@ void LDesktopBackground::setBackground(const QString& bgFile, const QString& for } else { mode = Qt::KeepAspectRatio; } - bgImage = bgImage.scaled(size(), mode); + if(bgImage.height() != this->height() && bgImage.width() != this->width() ){ bgImage = bgImage.scaled(size(), mode); } + //bgImage = bgImage.scaled(size(), mode); } // Calculate the offset -- cgit From e87ef3b22057ab391dc051c20667ba5d69888723 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 5 Oct 2016 07:12:23 -0400 Subject: Add a couple more fixes/bypasses to the start-lumina-desktop routine. 1) Make sure when re-calling with xinit, that the full path of the binary is used 2) When starting the desktop, try to detect/launch a temporary dbus session so that Qt can function properly without crashing. --- src-qt5/core/lumina-session/main.cpp | 6 ++++-- src-qt5/core/lumina-session/session.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp index 464302a7..24d32c52 100644 --- a/src-qt5/core/lumina-session/main.cpp +++ b/src-qt5/core/lumina-session/main.cpp @@ -33,8 +33,10 @@ int main(int argc, char ** argv) QString disp = QString(getenv("DISPLAY")).simplified(); if(disp.isEmpty()){ //No X session found. Go ahead and re-init this binary within an xinit call - QStringList args; args << QCoreApplication::applicationFilePath(); - if(LUtils::isValidBinary("x11vnc")){ args << "--" << "-listen" << "tcp"; } //need to be able to VNC into this session + QString prog = QCoreApplication::applicationFilePath().section("/",-1); + LUtils::isValidBinary(prog); //will adjust the path to be absolute + QStringList args; args << prog; + //if(LUtils::isValidBinary("x11vnc")){ args << "--" << "-listen" << "tcp"; } //need to be able to VNC into this session return QProcess::execute("xinit", args); } //Setup any initialization values diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 937f05d0..20c55ec4 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -11,6 +11,8 @@ #include #include #include +#include + #include #include @@ -56,6 +58,13 @@ void LSession::startProcess(QString ID, QString command, QStringList watchfiles) proc->setProcessChannelMode(QProcess::MergedChannels); proc->setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); proc->setStandardOutputFile(logfile); + if(ID=="runtime"){ + //Bypass for a hidden dbus requirement for Qt itself (Qt 5.5.1) + QDir tmp = QDir::temp(); + if( tmp.entryList(QStringList() << "dbus-*").isEmpty() && LUtils::isValidBinary("dbus-launch")){ + command.prepend("dbus-launch --exit-with-session "); + } + } proc->start(command, QIODevice::ReadOnly); connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(procFinished()) ); PROCS << proc; -- cgit From caea68731fac0339e512457d6d2506b3f4e88a06 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 5 Oct 2016 08:20:21 -0400 Subject: Convert over the desktop/panel settings to be based on screen ID instead of screen number. It seems like X randomly assigns numbers to screens in some instances - resulting in multi-monitor arrays occasionally getting rotated/scrambled. After the automatic conversion of the settings to the new system (the first time the user logs into the updated version of Lumina), screen settings are tied to that particular monitor now (HDMI-0, DP-1, etc...) --- src-qt5/core-utils/lumina-config/PanelWidget.cpp | 6 +- .../lumina-config/pages/page_interface_desktop.cpp | 6 +- .../lumina-config/pages/page_interface_panels.cpp | 6 +- src-qt5/core/libLumina/LuminaUtils.cpp | 66 ++++++++-------------- src-qt5/core/lumina-desktop/LDesktop.cpp | 6 +- src-qt5/core/lumina-desktop/LDesktopPluginSpace.h | 3 + src-qt5/core/lumina-desktop/LPanel.cpp | 5 +- 7 files changed, 47 insertions(+), 51 deletions(-) diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.cpp b/src-qt5/core-utils/lumina-config/PanelWidget.cpp index 8b38f407..aff7bda3 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.cpp +++ b/src-qt5/core-utils/lumina-config/PanelWidget.cpp @@ -42,7 +42,8 @@ PanelWidget::~PanelWidget(){ void PanelWidget::LoadSettings(QSettings *settings, int Dnum, int Pnum){ pnum = Pnum; dnum = Dnum; //save these for later ui->label->setText( QString(tr("Panel %1")).arg(QString::number(Pnum+1) ) ); - QString prefix = "panel"+QString::number(Dnum)+"."+QString::number(Pnum)+"/"; + QString screenID = QApplication::screens().at(Dnum)->name(); + QString prefix = "panel_"+screenID+"."+QString::number(Pnum)+"/"; qDebug() << "Loading Panel Settings:" << prefix; //Now load the settings into the GUI int tmp = ui->combo_align->findData( settings->value(prefix+"pinLocation","center").toString().toLower() ); @@ -78,7 +79,8 @@ void PanelWidget::LoadSettings(QSettings *settings, int Dnum, int Pnum){ } void PanelWidget::SaveSettings(QSettings *settings){//save the current settings - QString prefix = "panel"+QString::number(dnum)+"."+QString::number(pnum)+"/"; + QString screenID = QApplication::screens().at(dnum)->name(); + QString prefix = "panel_"+screenID+"."+QString::number(pnum)+"/"; qDebug() << "Saving panel settings:" << prefix; settings->setValue(prefix+"location", ui->combo_edge->currentData().toString() ); settings->setValue(prefix+"pinLocation", ui->combo_align->currentData().toString() ); diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp index fdcde804..f467db36 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp @@ -31,7 +31,8 @@ page_interface_desktop::~page_interface_desktop(){ //================ void page_interface_desktop::SaveSettings(){ QSettings settings("lumina-desktop","desktopsettings"); - QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + QString screenID = QApplication::screens().at(cscreen)->name(); + QString DPrefix = "desktop-"+screenID+"/"; settings.setValue(DPrefix+"generateDesktopIcons", ui->check_desktop_autolaunchers->isChecked() ); QStringList plugs; @@ -53,7 +54,8 @@ void page_interface_desktop::LoadSettings(int screennum){ emit HasPendingChanges(false); emit ChangePageTitle( tr("Desktop Settings") ); QSettings settings("lumina-desktop","desktopsettings"); - QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + QString screenID = QApplication::screens().at(cscreen)->name(); + QString DPrefix = "desktop-"+screenID+"/"; ui->check_desktop_autolaunchers->setChecked(settings.value(DPrefix+"generateDesktopIcons",false).toBool() ); QStringList dplugs = settings.value(DPrefix+"pluginlist",QStringList()).toStringList(); diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp index 0e486bdd..7d0d3d8c 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp @@ -30,7 +30,8 @@ page_interface_panels::~page_interface_panels(){ // PUBLIC SLOTS //================ void page_interface_panels::SaveSettings(){ - QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + QString screenID = QApplication::screens().at(cscreen)->name(); + QString DPrefix = "desktop-"+screenID+"/"; settings->setValue(DPrefix+"panels", PANELS.length()); for(int i=0; iSaveSettings(settings); @@ -48,7 +49,8 @@ void page_interface_panels::LoadSettings(int screennum){ loading = true; emit HasPendingChanges(false); emit ChangePageTitle( tr("Desktop Settings") ); - QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + QString screenID = QApplication::screens().at(cscreen)->name(); + QString DPrefix = "desktop-"+screenID+"/"; int panelnumber = settings->value(DPrefix+"panels",-1).toInt(); //First clean any current panels diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index db165cf2..9fc4e6b0 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -897,50 +898,31 @@ bool LUtils::checkUserFiles(QString lastversion){ if(newversion || newrelease){ LUtils::upgradeFavorites(oldversion); } - //Convert any "userbutton" and "appmenu" panel plugins to the new "systemstart" plugin (0.8.7) - /*if(oldversion <= 8007 && (newversion || newrelease) && nversion < 8008){ - QSettings dset(QSettings::UserScope, "LuminaDE","desktopsettings"); - QStringList plugKeys = dset.allKeys().filter("panel").filter("/pluginlist"); - for(int i=0; i systemstart conversion - plugs = plugs.join(";;;;").replace("userbutton","systemstart").replace("appmenu","systemstart").split(";;;;"); - //Remove any system dashboard plugins - plugs.removeAll("systemdashboard"); - //Now save that back to the file - dset.setValue(plugKeys[i], plugs); - } - //Also remove any "desktopview" desktop plugin and enable the automatic desktop icons instead - plugKeys = dset.allKeys().filter("desktop-").filter("/pluginlist"); - for(int i=0; i screens = QApplication::screens(); + for(int i=0; i=0 && ok && num< screens.length()){ + //This one needs to be converted + DS[i] = "[desktop-"+screens[num]->name()+"]"; + } + }else if(DS[i].startsWith("[panel")){ + bool ok = false; + int num = DS[i].section("panel",-1).section(".",0,0).toInt(&ok); + if(num>=0 && ok && num< screens.length()){ + //This one needs to be converted + QString rest = DS[i].section(".",1,-1); //everything after the desktop number in the current setting + DS[i] = "[panel_"+screens[num]->name()+"."+rest; + } } } - dset.sync(); - //Due to the grid size change for desktop plugins, need to remove any old plugin geometries - if(QFile::exists(QDir::homePath()+"/.lumina/pluginsettings/desktopsettings.conf")){ - QFile::remove(QDir::homePath()+"/.lumina/pluginsettings/desktopsettings.conf"); - } - }*/ - - //Convert to the XDG autostart spec as necessary (Change occured with 0.8.5) - /*if(QFile::exists(QDir::homePath()+"/.lumina/startapps") ){ - QStringList cmds = LUtils::readFile(QDir::homePath()+"/.lumina/startapps"); - for(int i=0; i + #define DEBUG 0 LDesktop::LDesktop(int deskNum, bool setdefault) : QObject(){ - - DPREFIX = "desktop-"+QString::number(deskNum)+"/"; + QString screenID = QApplication::screens().at(deskNum)->name(); + DPREFIX = "desktop-"+screenID+"/"; desktopnumber = deskNum; desktop = QApplication::desktop(); defaultdesktop = setdefault; //(desktop->screenGeometry(desktopnumber).x()==0); diff --git a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h index 92226680..44765029 100644 --- a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h +++ b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h @@ -183,6 +183,9 @@ private slots: } protected: + void paintEvent(QPaintEvent*){ + //do nothing here - the main plugin area should *always* be invisible + } //Need Drag and Drop functionality (internal movement) void dragEnterEvent(QDragEnterEvent *ev){ if(ev->mimeData()->hasFormat(MIMETYPE) ){ diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index bf063a31..b0abf498 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -6,6 +6,8 @@ //=========================================== #include "LPanel.h" #include "LSession.h" +#include + #include "panel-plugins/systemtray/LSysTray.h" #define DEBUG 0 @@ -26,7 +28,8 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ screennum = scr; panelnum = num; //save for later screen = LSession::desktop(); - PPREFIX = "panel"+QString::number(screennum)+"."+QString::number(num)+"/"; + QString screenID = QApplication::screens().at(screennum)->name(); + PPREFIX = "panel_"+screenID+"."+QString::number(num)+"/"; defaultpanel = (LSession::handle()->screenGeom(screennum).x()==0 && num==0); horizontal=true; //use this by default initially hidden = false; //use this by default -- cgit From babd84407a6a3475694268a3966f47a683e4d3cd Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 5 Oct 2016 17:52:52 -0400 Subject: Add a new Lumina project: desktop-utils/lumina-calculator This is just a very basic calculator at the moment. It still need more buttons/icons/features/etc added to it, but the algorithm and mathematics are already functional for evaluation expressions containing: Addition/Subtraction (+/-) Multiplication/Division( * or x, and /) Order of operations when mixing operations, including expressions within parentheses --- .../lumina-calculator/lumina-calculator.pro | 92 ++++++++++++++++++++++ src-qt5/desktop-utils/lumina-calculator/main.cpp | 19 +++++ src-qt5/desktop-utils/lumina-calculator/mainUI.cpp | 92 ++++++++++++++++++++++ src-qt5/desktop-utils/lumina-calculator/mainUI.h | 33 ++++++++ src-qt5/desktop-utils/lumina-calculator/mainUI.ui | 54 +++++++++++++ 5 files changed, 290 insertions(+) create mode 100644 src-qt5/desktop-utils/lumina-calculator/lumina-calculator.pro create mode 100644 src-qt5/desktop-utils/lumina-calculator/main.cpp create mode 100644 src-qt5/desktop-utils/lumina-calculator/mainUI.cpp create mode 100644 src-qt5/desktop-utils/lumina-calculator/mainUI.h create mode 100644 src-qt5/desktop-utils/lumina-calculator/mainUI.ui diff --git a/src-qt5/desktop-utils/lumina-calculator/lumina-calculator.pro b/src-qt5/desktop-utils/lumina-calculator/lumina-calculator.pro new file mode 100644 index 00000000..8c36c516 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-calculator/lumina-calculator.pro @@ -0,0 +1,92 @@ +include("$${PWD}/../../OS-detect.pri") + +QT += core gui widgets + +TARGET = lumina-calculator +target.path = $${L_BINDIR} + +HEADERS += mainUI.h + +SOURCES += main.cpp \ + mainUI.cpp + +FORMS += mainUI.ui + +LIBS += -lLuminaUtils + +DEPENDPATH += ../../libLumina + +TRANSLATIONS = i18n/l-calc_af.ts \ + i18n/l-calc_ar.ts \ + i18n/l-calc_az.ts \ + i18n/l-calc_bg.ts \ + i18n/l-calc_bn.ts \ + i18n/l-calc_bs.ts \ + i18n/l-calc_ca.ts \ + i18n/l-calc_cs.ts \ + i18n/l-calc_cy.ts \ + i18n/l-calc_da.ts \ + i18n/l-calc_de.ts \ + i18n/l-calc_el.ts \ + i18n/l-calc_en_GB.ts \ + i18n/l-calc_en_ZA.ts \ + i18n/l-calc_es.ts \ + i18n/l-calc_et.ts \ + i18n/l-calc_eu.ts \ + i18n/l-calc_fa.ts \ + i18n/l-calc_fi.ts \ + i18n/l-calc_fr.ts \ + i18n/l-calc_fr_CA.ts \ + i18n/l-calc_gl.ts \ + i18n/l-calc_he.ts \ + i18n/l-calc_hi.ts \ + i18n/l-calc_hr.ts \ + i18n/l-calc_hu.ts \ + i18n/l-calc_id.ts \ + i18n/l-calc_is.ts \ + i18n/l-calc_it.ts \ + i18n/l-calc_ja.ts \ + i18n/l-calc_ka.ts \ + i18n/l-calc_ko.ts \ + i18n/l-calc_lt.ts \ + i18n/l-calc_lv.ts \ + i18n/l-calc_mk.ts \ + i18n/l-calc_mn.ts \ + i18n/l-calc_ms.ts \ + i18n/l-calc_mt.ts \ + i18n/l-calc_nb.ts \ + i18n/l-calc_nl.ts \ + i18n/l-calc_pa.ts \ + i18n/l-calc_pl.ts \ + i18n/l-calc_pt.ts \ + i18n/l-calc_pt_BR.ts \ + i18n/l-calc_ro.ts \ + i18n/l-calc_ru.ts \ + i18n/l-calc_sk.ts \ + i18n/l-calc_sl.ts \ + i18n/l-calc_sr.ts \ + i18n/l-calc_sv.ts \ + i18n/l-calc_sw.ts \ + i18n/l-calc_ta.ts \ + i18n/l-calc_tg.ts \ + i18n/l-calc_th.ts \ + i18n/l-calc_tr.ts \ + i18n/l-calc_uk.ts \ + i18n/l-calc_uz.ts \ + i18n/l-calc_vi.ts \ + i18n/l-calc_zh_CN.ts \ + i18n/l-calc_zh_HK.ts \ + i18n/l-calc_zh_TW.ts \ + i18n/l-calc_zu.ts + +dotrans.path=$${L_SHAREDIR}/lumina-desktop/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/i18n/ + +#desktop.files=lumina-calculator.desktop +#desktop.path=$${L_SHAREDIR}/applications/ + +INSTALLS += target + +WITH_I18N{ + INSTALLS += dotrans +} diff --git a/src-qt5/desktop-utils/lumina-calculator/main.cpp b/src-qt5/desktop-utils/lumina-calculator/main.cpp new file mode 100644 index 00000000..af252cb3 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-calculator/main.cpp @@ -0,0 +1,19 @@ +//=========================================== +// Lumina Desktop source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include +#include + +#include "mainUI.h" + +int main(int argc, char *argv[]) { + QApplication a(argc, argv); + + //Now start the window + mainUI W; + W.show(); + return a.exec(); +} diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp new file mode 100644 index 00000000..18d2cfdd --- /dev/null +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp @@ -0,0 +1,92 @@ +//=========================================== +// Lumina Desktop source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "mainUI.h" +#include "ui_mainUI.h" + +#include + +#define VALIDSYMBOLS QString("+-*x/.") + +#include +#define BADVALUE NAN + +mainUI::mainUI() : QMainWindow(), ui(new Ui::mainUI()){ + ui->setupUi(this); + connect(ui->tool_start, SIGNAL(clicked()), this, SLOT(start_calc()) ); + connect(ui->line_eq, SIGNAL(returnPressed()), this, SLOT(start_calc()) ); + ui->line_eq->setFocus(); +} + +mainUI::~mainUI(){ + +} + +void mainUI::start_calc(){ + if(ui->line_eq->text().isEmpty()){ return; } //nothing to do + double result = strToNumber(ui->line_eq->text()); + if(result!=result){ return; } //bad calculation - NaN's values are special in that they don't equal itself + QString res = "%1 \t(%2)"; + ui->list_results->addItem(res.arg(QString::number(result), ui->line_eq->text())); + ui->list_results->scrollToItem( ui->list_results->item( ui->list_results->count()-1) ); + ui->line_eq->clear(); +} + +double mainUI::performOperation(double LHS, double RHS, QChar symbol){ + if(symbol== '+'){ return (LHS+RHS); } + else if(symbol== '-'){ return (LHS-RHS); } + else if(symbol== '*' || symbol=='x'){ return (LHS*RHS); } + else if(symbol== '/'){ return (LHS/RHS); } + //else if(symbol== '%'){ return (LHS%RHS); } + qDebug() << "Invalid Symbol:" << symbol; + return BADVALUE; +} + +double mainUI::strToNumber(QString str){ + //Look for perentheses first + qDebug() << "String to Number: " << str; + if(str.indexOf("(")>=0){ + //qDebug() << "Found Parenthesis"; + int start = str.indexOf("("); + int need = 1; + int end = -1; + for(int i=start+1; i0; i++){ + if(str[i]=='('){ need++; } + else if(str[i]==')'){ need--; } + //qDebug() << "Check char:" << str[i] << need; + if(need==0){ end = i; } + } + if(end0){ return performOperation( strToNumber(str.left(sym)), strToNumber(str.right(str.length()-sym-1)), str[sym]); } + if(sym==0){ return BADVALUE; } + //Now look for multiply/divide + symbols.clear(); symbols << "x" << "*" << "/"; + for(int i=0; i0){ return performOperation( strToNumber(str.left(sym)), strToNumber(str.right(str.length()-sym-1)), str[sym]); } + if(sym==0){ return BADVALUE; } + + //Could not find any operations - must be a raw number + //qDebug() << "Found Number:" << str.toDouble(); + return str.toDouble(); +} diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.h b/src-qt5/desktop-utils/lumina-calculator/mainUI.h new file mode 100644 index 00000000..96414252 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.h @@ -0,0 +1,33 @@ +//=========================================== +// Lumina Desktop source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CALCULATOR_MAIN_UI_H +#define _LUMINA_CALCULATOR_MAIN_UI_H + +#include +#include +#include + +namespace Ui{ + class mainUI; +}; + +class mainUI : public QMainWindow{ + Q_OBJECT +public: + mainUI(); + ~mainUI(); + +private slots: + void start_calc(); + +private: + Ui::mainUI *ui; + + double performOperation(double LHS, double RHS, QChar symbol); + double strToNumber(QString str); //this is highly-recursive +}; +#endif diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.ui b/src-qt5/desktop-utils/lumina-calculator/mainUI.ui new file mode 100644 index 00000000..0e52f4db --- /dev/null +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.ui @@ -0,0 +1,54 @@ + + + mainUI + + + + 0 + 0 + 245 + 149 + + + + Calculator + + + + + + + + + + + + + + + ... + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + -- cgit From 91bcdffac01e86eb06a08478fa418adfc2292a2b Mon Sep 17 00:00:00 2001 From: Sven Putze Date: Tue, 11 Oct 2016 07:54:50 +0000 Subject: Translated using Weblate (lumina_FM@de (generated)) Currently translated at 97.6% (207 of 212 strings) --- .../desktop-utils/lumina-fm/i18n/lumina-fm_de.ts | 510 ++++++++++----------- 1 file changed, 255 insertions(+), 255 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts index 50acc59f..b846df75 100644 --- a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts +++ b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts @@ -1,55 +1,55 @@ - + BMMDialog - + Manage Bookmarks Lesezeichen verwalten - + Name Name - + Path Pfad - + Remove Bookmark Lesezeichen entfernen - + Rename BookMark Lesezeichen umbenennen - + Finished Abgeschlossen - + Rename Bookmark Lesezeichen umbenennen - + Name: Name: - + Invalid Name Ungültiger Name - + This bookmark name already exists. Please choose another. Der Name des Lesezeichens ist bereits vorhanden. Bitte einen anderen Namen wählen. @@ -57,310 +57,310 @@ DirWidget - + Form Not sure what this relates to as the meaning would differ when put in different contexts Form - - + + Open item Objekt öffnen - - + + Open item (select application) Objekt öffnen (Anwendung auswählen) - - + + Add item to personal favorites Füge Objekt den persönlichen Favoriten hinzu - - + + Rename item Objekt umbenennen - + Cut items Objekte ausschneiden - + Cut items (add to the clipboard) Objekte ausschneiden (zur Zwischenablage hinzufügen) - + Copy items Objekte kopieren - + Copy items to the clipboard Objekte in die Zwischenablage kopieren - - + + Paste items from clipboard Objekte aus der Zwischenablage einfügen - - + + Delete Items Objekte löschen - + Stop loading the directory Laden des Verzeichnisses abbrechen - + Add selected images to slideshow Füge ausgewählte Bilder der Präsentation hinzu - + Create a new directory Erstelle neues Verzeichnis - + New Dir Neues Verzeichnis - + Create a new file Erstelle neue Datei - + New File Neue Datei - + Slideshow Präsentation - + Enqueue selection in multimedia player reihe Auswahl in Wiedergabeliste ein - + Play Wiedergabe - + Back Zurück - - + + Go back to previous directory zurück zum vorhergehenden Verzeichnis - + Up hoch - - + + Go to parent directory Zum übergeordneten Verzeichnis wechseln - + Home Persönlicher Ordner - - + + Go to home directory Gehe zum persönlichen Verzeichnis - - + + Close this browser Diesen Browser schließen - + Name Name - + Size Größe - + Type Typ - + Date Modified Änderungsdatum - + Date Created Erstellungsdatum - - + + (Limited Access) (Beschränkter Zugriff) - + Capacity: %1 Kapazität: %1 - + Files: %1 (%2) Dateien: %1 (%2) - + Dirs: %1 Verzeichnisse: %1 - + New Document Neues Dokument - - + + Name: Name: - + Error Creating Document Fehler beim Erstellen des Dokuments - + The document could not be created. Please ensure that you have the proper permissions. Das Dokument konnte nicht erstellt werden. Bitte stelle sicher, dass du die korrekten Dateirechte hast. - + New Directory Neues Verzeichnis - + Invalid Name Ungültiger Name - + A file or directory with that name already exists! Please pick a different name. Eine Datei oder ein Ordner mit diesem Namen existiert bereits! Bitte einen neuen Namen auswählen. - + Error Creating Directory Fehler beim Erstellen des Verzeichnisses - + The directory could not be created. Please ensure that you have the proper permissions to modify the current directory. Das Verzeichnis konnte nicht erstellt werden. Bitte sicherstellen, dass du die nötigen Rechte zum modifizieren des Verzeichnisses hast. - + Current Aktuell - + File Checksums: Datei-Prüfsummen - + Missing Utility Fehlendes Dienstprogramm - - The "lumina-fileinfo" utility could not be found on the system. Please install it first. - Das "lumina-fileinfo" Dienstprogramm konnte nicht gefunden werden. Bitte erst installieren. + + The "lumina-fileinfo" utility could not be found on the system. Please install it first. + Das "lumina-fileinfo" Dienstprogramm konnte nicht gefunden werden. Bitte erst installieren. - + Open Öffnen - + Open With... Öffnen mit... - + Rename... Umbenennen … - + View Checksums... Prüfsummen anzeigen... - + File Properties... Dateieigenschaften... - + Cut Selection Auswahl ausschneiden - + Copy Selection Auswahl kopieren - + Paste Einfügen - + Delete Selection Auswahl löschen - + Open Terminal here Terminal hier öffnen @@ -368,82 +368,82 @@ FODialog - + Performing File Operations Dateioperationen ausführen - + %v/%m %v/%m - + Stop Anhalten - + Calculating Berechne - + Overwrite Files? Dateien überschreiben? - + Do you want to overwrite the existing files? Sollen diese Dateien überschrieben werden? - + Note: It will just add a number to the filename otherwise. Hinweis: Sonst wird nur eine Nummer an den Dateinamen angehängt. - + Removing: %1 %1 wird entfernt - + Copying: %1 to %2 %1 nach %2 kopieren - + Restoring: %1 as %2 stelle %1 als %2 wieder her - + Moving: %1 to %2 %1 nach %2 verschieben - + Could not remove these files: Diese Dateien lassen sich nicht löschen: - + Could not copy these files: Konnte diese Dateien nicht kopieren: - + Could not restore these files: - Diese Dateien konnte nicht wiederhergestellt werden: + Diese Dateien konnten nicht wiederhergestellt werden: - + Could not move these files: Diese Dateien konnten nicht verschoben werden: - + File Errors Dateifehler @@ -451,12 +451,12 @@ FOWorker - + Invalid Move Ungültiger Zug - + It is not possible to move a directory into itself. Please make a copy of the directory instead. Old Location: %1 @@ -470,501 +470,501 @@ Neue Position: %2 GitWizard - + Clone a Git Repository - + Ein Git Repository klonen - + Welcome! - + Willkommen! - + This wizard will guide you through the process of downloading a GIT repository from the internet. - + Der Assistent wird Sie beim Herunterladen eines Git Repositorys aus dem Internet unterstützen. - + GitHub Repository Settings - + GitHub Repository Einstellungen - + Organization/User - + Organisation/Benutzer - + Repository Name - + Name des Repositorys - + Is Private Repository - + ist ein privates Repository - + Type of Access - + Zugriffstyp - + Use my SSH Key - + Meinen SSH Key benutzen - + Login to server - + An Server anmelden - + Username - + Benutzername - + Password - + Kennwort - + Anonymous (public repositories only) - + Anonym (nur öffentliche Repositorys) - + Optional SSH Password - + Optionales SSH Kennwort - + Advanced Options - + Erweiterte Einstellungen - + Custom Depth - + Benutzerdefinierter Wert für "depth" - + Single Branch - + Single Branch - + branch name - - Click "Next" to start downloading the repository - + + Click "Next" to start downloading the repository + Auf "Weiter" klicken, um das Repository herunterzuladen - + Stop Download? - + Download beenden? - + Kill the current download? - + Den aktuellen Download zwangsweise beenden? MainUI - + Insight Einsicht - + Shift+Left Umschalt+Links - + Shift+Right Umschalt+Rechts - + File Datei - + View Ansicht - + View Mode Ansichtsmodus - + Group Mode Gruppenmodus - + Bookmarks Lesezeichen - + External Devices Externe Geräte - + Edit Bearbeiten - + Git - - + + New Browser neuer Browser - + Search Directory... Suche im Verzeichnis... - + Increase Icon Size Symbolgröße vergrößern - + Decrease Icon Size Symbolgröße verkleinern - + Larger Icons Größere Symbole - + Ctrl++ Strg++ - + Smaller Icons Kleinere Symbole - + Ctrl+- Strg+- - + New Window Neues Fenster - + Ctrl+N Strg+N - + Add Bookmark Lesezeichen hinzufügen - + Ctrl+D Strg+D - + Delete Selection Auswahl löschen - + Del Entf - + Refresh Aktualisieren - + Close Browser Browser schließen - + Repo Status - + Clone Repository - + Ctrl+T Strg+T - + Exit Beenden - + Ctrl+Q Strg+Q - + &Preferences &Persönliche Einstellungen - + Show Hidden Files Versteckte Dateien anzeigen - + Scan for Devices Nach Geräten suchen - + Manage Bookmarks Lesezeichen verwalten - + Show Action Buttons Schaltknöpfe anzeigen - + Load Thumbnails lade Vorschaubilder - + Ctrl+F Strg+F - + Detailed List Detailansicht - + Basic List Einfache Liste - + Ctrl+W Strg+W - + Prefer Tabs Tabs bevorzugen - + Prefer Columns Spalten bevorzugen - + F5 F5 - + Ctrl+C Strg+C - + Rename... Umbenennen … - + F2 F2 - + Cut Selection Auswahl ausschneiden - + Copy Selection Auswahl kopieren - + Paste Einfügen - + Ctrl+V Strg+V - + Ctrl+X Strg+X - + Invalid Directories Ungültiges Verzeichnis - + The following directories are invalid and could not be opened: Die folgenden Verzeichnis sind ungültig und können nicht geöffnet werden: - + Root Basisverzeichnis - + %1 (Type: %2) %1 (Typ: %2) - + Filesystem: %1 Dateisystem: %1 - + Browser Browser - + New Bookmark Neues Lesezeichen - + Name: Name: - + Invalid Name Ungültiger Name - + This bookmark name already exists. Please choose another. Der Name des Lesezeichens ist bereits vorhanden. Bitte einen anderen Namen wählen. - + Git Repository Status - + Multimedia Multimedia - + Slideshow Präsentation - + Items to be removed: Elemente, welche entfernt werden sollen: - + Verify Quit Beenden bestätigen - + Ctrl+H Strg+H - + Ctrl+L Strg+L - + You have multiple tabs open. Are you sure you want to quit? Es sind mehrere Reiter offen. Soll wirklich beendet werden? - + Verify Removal Entfernen überprüfen - + WARNING: This will permanently delete the file(s) from the system! ACHTUNG: Dies wird die Datei(en) dauerhaft vom System entfernen! - + Are you sure you want to continue? Sind Sie sicher, dass Sie fortsetzen möchten? - + Rename File Datei umbenennen - + New Name: Neuer Name: - + Overwrite File? Datei überschreiben? - + An existing file with the same name will be replaced. Are you sure you want to proceed? Eine vorhandene Datei mit dem gleichen Namen wird ersetzt. Fortfahren? @@ -972,37 +972,37 @@ Neue Position: %2 MultimediaWidget - + Form Form - + Go To Next Gehe zum Nächsten - + (No Running Video) (Kein laufendes Video) - + Playing: Wiedergabe: - + Stopped Angehalten - + Error Playing File: %1 Fehler beim Abspielen der Datei: %1 - + Finished Abgeschlossen @@ -1010,102 +1010,102 @@ Neue Position: %2 SlideshowWidget - + Form Form - + Delete this image file Diese Bilddatei löschen - + Rotate this image file counter-clockwise Dieses Bild gegen den Uhrzeigersinn drehen - + Rotate this image file clockwise Dieses Bild im Uhrzeigersinn drehen - - + + Zoom in Hineinzoomen - - + + Zoom out Herauszoomen - + Go to Beginning Gehe zum Anfang - - - - + + + + ... ... - + Shift+Left Umschalt+Links - + Go to Previous Gehe zum Vorherigen - + Left Links - + File Name Dateiname - + Go to Next Gehe zum Nächsten - + Right Rechts - + Go to End Gehe zum Ende - + Shift+Right Umschalt+Rechts - + Verify Removal Entfernen verifizieren - + WARNING: This will permanently delete the file from the system! ACHTUNG: Die Datei wird permanent vom System gelöscht! - + Are you sure you want to continue? Bist du sicher, dass Du fortsetzen möchtest? -- cgit From e56f3d80e396ee432ed41d26555e22ed1bce1d7d Mon Sep 17 00:00:00 2001 From: Ettore Atalan Date: Mon, 10 Oct 2016 17:59:38 +0000 Subject: Translated using Weblate (l_SCREENSHOT@de (generated)) Currently translated at 100.0% (24 of 24 strings) --- .../lumina-screenshot/i18n/l-screenshot_de.ts | 62 +++++++++++----------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts index efda8a4c..13a8096e 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_de.ts @@ -1,15 +1,15 @@ - + ImageEditor - + Zoom In Vergrößern - + Zoom Out Verkleinern @@ -17,115 +17,115 @@ MainUI - - - + + + Take Screenshot Bildschirmfoto erstellen - + New Screenshot Neues Bildschirmfoto - + Settings Einstellungen - + Include Borders Rahmen inkludieren - + Seconds Sekunden - + Delay Verzögerung - + View/Edit Ansicht/Bearbeiten - - + + Save As Speichern unter - + Launch Editor Editor starten - + Crop Zuschneiden - + Resize Größe ändern - + File Datei - + Ctrl+N Strg+N - + Close Schließen - + Esc Esc - + Entire Session - vollständige Session + Vollständige Sitzung - + Single Window - einzelnes Fenster + Einzelnes Fenster - + Single Screen - einzelner Bildschirm + Einzelner Bildschirm - + Save Screenshot Bildschirmfoto speichern - + Ctrl+S Strg+S - + Quick Save Schnellspeichern - + PNG Files (*.png);;AllFiles (*) PNG-Dateien (*.png);;Alle Dateien (*) -- cgit From 632588740c5f53aa0fe5809a6ee9426a1eee4ff9 Mon Sep 17 00:00:00 2001 From: Sven Putze Date: Tue, 11 Oct 2016 07:57:04 +0000 Subject: Translated using Weblate (lumina_FM@de (generated)) Currently translated at 100.0% (212 of 212 strings) Easier to underdtand with the english source --- src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts index b846df75..ab57fe64 100644 --- a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts +++ b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_de.ts @@ -557,7 +557,7 @@ Neue Position: %2 branch name - + Branch Name @@ -630,7 +630,7 @@ Neue Position: %2 Git - + Git @@ -716,12 +716,12 @@ Neue Position: %2 Repo Status - + Status des Repositorys Clone Repository - + Repository klonen @@ -896,7 +896,7 @@ Neue Position: %2 Git Repository Status - + Status des Git Repositorys -- cgit From 1da456302b2fab1fdaab989abd51b11ed23f9a2a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 11 Oct 2016 07:40:31 -0400 Subject: Fix up the logout bug in Lumina after some changes to the startup routine. --- src-qt5/core/lumina-session/main.cpp | 2 +- src-qt5/core/lumina-session/session.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp index 24d32c52..77e553d4 100644 --- a/src-qt5/core/lumina-session/main.cpp +++ b/src-qt5/core/lumina-session/main.cpp @@ -33,7 +33,7 @@ int main(int argc, char ** argv) QString disp = QString(getenv("DISPLAY")).simplified(); if(disp.isEmpty()){ //No X session found. Go ahead and re-init this binary within an xinit call - QString prog = QCoreApplication::applicationFilePath().section("/",-1); + QString prog = QString(argv[0]).section("/",-1); LUtils::isValidBinary(prog); //will adjust the path to be absolute QStringList args; args << prog; //if(LUtils::isValidBinary("x11vnc")){ args << "--" << "-listen" << "tcp"; } //need to be able to VNC into this session diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 20c55ec4..2647e58d 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -36,7 +36,8 @@ void LSession::procFinished(){ stopped++; if(!stopping){ //See if this process is the main desktop binary - if(PROCS[i]->program().section("/",-1) == "lumina-desktop"){ stopall(); } //start closing down everything + if(PROCS[i]->objectName()=="runtime"){ stopall(); } + //if(PROCS[i]->program().section("/",-1) == "lumina-desktop"){ stopall(); } //start closing down everything //else{ PROCS[i]->start(QIODevice::ReadOnly); } //restart the process break; } @@ -58,6 +59,7 @@ void LSession::startProcess(QString ID, QString command, QStringList watchfiles) proc->setProcessChannelMode(QProcess::MergedChannels); proc->setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); proc->setStandardOutputFile(logfile); + proc->setObjectName(ID); if(ID=="runtime"){ //Bypass for a hidden dbus requirement for Qt itself (Qt 5.5.1) QDir tmp = QDir::temp(); -- cgit From a68cd74ded1278b94f75248c9d38dedbe969f7e6 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 11 Oct 2016 07:49:34 -0400 Subject: Move a couple "delete" calls to "deleteLater()" within the desktop. --- src-qt5/core/lumina-desktop/LSession.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 434bfd2d..9a985b3f 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -70,11 +70,11 @@ LSession::~LSession(){ if(this->isPrimaryProcess()){ //WM->stopWM(); for(int i=0; ideleteLater(); } //delete WM; - delete settingsmenu; - delete appmenu; + settingsmenu->deleteLater(); + appmenu->deleteLater(); delete currTranslator; if(mediaObj!=0){delete mediaObj;} } @@ -207,7 +207,7 @@ void LSession::CleanupSession(){ } evFilter->StopEventHandling(); //Stop the window manager - qDebug() << " - Stopping the window manager"; + //qDebug() << " - Stopping the window manager"; //WM->stopWM(); //Now close down the desktop qDebug() << " - Closing down the desktop elements"; -- cgit From 566a86a71d4f76fcd4d1db604aa4e38712bdea7a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 11 Oct 2016 08:33:33 -0400 Subject: Fix a bug in LFileInfo, and update lumina-fileinfo to show the size of the image (if an image file is being viewed) --- src-qt5/core/libLumina/LuminaXDG.cpp | 1 + src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index dbb70e43..8ae77ea6 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -568,6 +568,7 @@ QString LFileInfo::iconfile(){ // -- Check if this is an XDG desktop file bool LFileInfo::isDesktopFile(){ + if(desk==0){ return false; } return (!desk->filePath.isEmpty()); } diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp index dfa1ec36..8a16f03f 100644 --- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp @@ -41,8 +41,8 @@ void MainUI::LoadFile(QString path, QString type){ if(INFO->exists()){ canwrite = INFO->isWritable(); } else if(!INFO->filePath().isEmpty()){ //See if the containing directory can be written - QFileInfo chk(INFO->absolutePath()); - canwrite = (chk.isDir() && chk.isWritable()); + //QFileInfo chk(INFO->absolutePath()); + canwrite = (INFO->isDir() && INFO->isWritable()); }else{ canwrite = true; //no associated file yet } @@ -82,21 +82,29 @@ void MainUI::LoadFile(QString path, QString type){ ui->label_file_type->setText(ftype); //Now load the icon for the file if(INFO->isImage()){ - ui->label_file_icon->setPixmap( QPixmap(INFO->absoluteFilePath()).scaledToHeight(64) ); + //qDebug() << "Set Image:"; + QPixmap pix(INFO->absoluteFilePath()); + ui->label_file_icon->setPixmap( pix.scaledToHeight(64) ); + ui->label_file_size->setText( ui->label_file_size->text()+" ("+QString::number(pix.width())+" x "+QString::number(pix.height())+" px)" ); + //qDebug() << " - done with image"; }else{ ui->label_file_icon->setPixmap( LXDG::findIcon( INFO->iconfile(), "unknown").pixmap(QSize(64,64)) ); } //Now verify the tab is available in the widget + //qDebug() << "Check tab widget"; if(ui->tabWidget->indexOf(ui->tab_file)<0){ + //qDebug() << "Add File Info Tab"; ui->tabWidget->addTab(ui->tab_file, tr("File Information")); } + //qDebug() << "Done with Tab Check"; }else{ if(ui->tabWidget->indexOf(ui->tab_file)>=0){ ui->tabWidget->removeTab( ui->tabWidget->indexOf(ui->tab_file) ); } } //Now load the special XDG desktop info - qDebug() << INFO->isDesktopFile() << type; + qDebug() << "Check XDG Info:" << type; + //qDebug() << INFO->isDesktopFile() << type; if(INFO->isDesktopFile() || !type.isEmpty()){ if(INFO->XDG()->type == XDGDesktop::APP){ @@ -142,6 +150,7 @@ void MainUI::LoadFile(QString path, QString type){ //Setup the tab if(type.isEmpty()){ ui->tabWidget->setCurrentIndex(0); } else if(ui->tabWidget->count()>1){ ui->tabWidget->setCurrentIndex(1); } + qDebug() << "Done Loading File"; } void MainUI::UpdateIcons(){ -- cgit From 5516ffe1cc233d66a86c024130520e027b15ab6d Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 11 Oct 2016 08:38:54 -0400 Subject: Make lumina-screenshot single-instanced, and adjust the .desktop entry to *always* open a new window. --- src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.desktop | 2 +- src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro | 2 +- src-qt5/desktop-utils/lumina-screenshot/main.cpp | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.desktop b/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.desktop index b1c386fc..c4678265 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.desktop +++ b/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=lumina-screenshot +Exec=lumina-screenshot -new-instance Icon=camera-web Terminal=false Type=Application diff --git a/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro b/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro index 6f47f61f..a85b234c 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro +++ b/src-qt5/desktop-utils/lumina-screenshot/lumina-screenshot.pro @@ -1,6 +1,6 @@ include("$${PWD}/../../OS-detect.pri") -QT += core gui +QT += core gui network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras diff --git a/src-qt5/desktop-utils/lumina-screenshot/main.cpp b/src-qt5/desktop-utils/lumina-screenshot/main.cpp index aee374b0..27e1f2ff 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/main.cpp +++ b/src-qt5/desktop-utils/lumina-screenshot/main.cpp @@ -7,14 +7,15 @@ #include #include #include +#include int main(int argc, char ** argv) { LTHEME::LoadCustomEnvSettings(); - QApplication a(argc, argv); + LSingleApplication a(argc, argv, "l-screenshot"); LuminaThemeEngine theme(&a); a.setApplicationName("Take Screenshot"); - LUtils::LoadTranslation(&a, "l-screenshot"); + //LUtils::LoadTranslation(&a, "l-screenshot"); MainUI w; QObject::connect(&theme,SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); -- cgit From bceb1ec76fafddb6583378257a4120061dfab4bd Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 11 Oct 2016 09:05:04 -0400 Subject: Update the links for the Gitter chat and bug tracker in lumina-info. Fixes #277 --- src-qt5/core/lumina-info/MainUI.ui | 4 ++-- src-qt5/core/lumina-info/main.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src-qt5/core/lumina-info/MainUI.ui b/src-qt5/core/lumina-info/MainUI.ui index e1feab0a..ecb562b8 100644 --- a/src-qt5/core/lumina-info/MainUI.ui +++ b/src-qt5/core/lumina-info/MainUI.ui @@ -146,7 +146,7 @@ - https://bugs.pcbsd.org/projects/pcbsd + https://github.com/trueos/lumina/issues Bug Reports @@ -270,7 +270,7 @@ - https://webchat.freenode.net/?channels=%23lumina-desktop + https://gitter.im/trueos/lumina?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge Ask the Community diff --git a/src-qt5/core/lumina-info/main.cpp b/src-qt5/core/lumina-info/main.cpp index b8eb0dce..8fe6a183 100644 --- a/src-qt5/core/lumina-info/main.cpp +++ b/src-qt5/core/lumina-info/main.cpp @@ -16,7 +16,7 @@ int main(int argc, char ** argv) LSingleApplication a(argc, argv, "lumina-info"); //loads translations inside constructor if( !a.isPrimaryProcess()){ return 0; } //qDebug() << "Set Application Name"; - a.setApplicationName("About Lumina-DE"); + a.setApplicationName("About Lumina"); //qDebug() << "Load Theme Engine"; LuminaThemeEngine themes(&a); //qDebug() << "Start the UI"; -- cgit From c82b3b2e3b10210583f8ae606fc78cfc5b0daad1 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 11 Oct 2016 09:25:23 -0400 Subject: Adjust the FreeBSD CPU temperature routine to use the dev.cpu.* values if available, and fall back on the hw.acpi values otherwise (direct readings seem to be more accurate in some instances). --- src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp index 5cdf18bc..d0e8cb4e 100644 --- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp @@ -292,8 +292,10 @@ QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as QStringList LOS::CPUTemperatures(){ //Returns: List containing the temperature of any CPU's ("50C" for example) static QStringList vars = QStringList(); QStringList temps; - if(vars.isEmpty()){ temps = LUtils::getCmdOutput("sysctl -i hw.").filter(".temperature:"); } - else{ temps = LUtils::getCmdOutput("sysctl "+vars.join(" ")); vars.clear(); } + if(vars.isEmpty()){ + temps = LUtils::getCmdOutput("sysctl -i dev.cpu").filter(".temperature:"); //try direct readings first + if(temps.isEmpty()){ LUtils::getCmdOutput("sysctl -i hw.acpi").filter(".temperature:"); } // then try acpi values + }else{ temps = LUtils::getCmdOutput("sysctl "+vars.join(" ")); vars.clear(); } temps.sort(); for(int i=0; i Date: Tue, 11 Oct 2016 09:47:41 -0400 Subject: Add a "launch" option within the context menu for applauncher desktop plugins. Fixes #272 --- src-qt5/core/lumina-desktop/LXcbEventFilter.cpp | 2 +- src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.cpp | 8 +++++++- src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.h | 1 + .../desktop-plugins/applauncher/AppLauncherPlugin.cpp | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src-qt5/core/lumina-desktop/LXcbEventFilter.cpp b/src-qt5/core/lumina-desktop/LXcbEventFilter.cpp index 3c92c050..ca7fb38d 100644 --- a/src-qt5/core/lumina-desktop/LXcbEventFilter.cpp +++ b/src-qt5/core/lumina-desktop/LXcbEventFilter.cpp @@ -48,7 +48,7 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag session->RootSizeChange(); }else if( ((xcb_property_notify_event_t*)ev)->window == QX11Info::appRootWindow() \ && ( ( ((xcb_property_notify_event_t*)ev)->atom == session->XCB->EWMH._NET_CURRENT_DESKTOP) )){ - qDebug() << "Got Workspace Change"; + //qDebug() << "Got Workspace Change"; session->emit WorkspaceChanged(); }else if( SysNotifyAtoms.contains( ((xcb_property_notify_event_t*)ev)->atom ) ){ //Update the status/list of all running windows diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.cpp index 69505705..545ba430 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.cpp @@ -33,6 +33,12 @@ LDPlugin::LDPlugin(QWidget *parent, QString id) : QFrame(parent){ 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(); @@ -54,4 +60,4 @@ void LDPlugin::setupMenu(){ } //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()); -}*/ \ No newline at end of file +}*/ diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.h b/src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.h index 27fcaa24..820880ed 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.h +++ b/src-qt5/core/lumina-desktop/desktop-plugins/LDPlugin.h @@ -106,6 +106,7 @@ 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 diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp index b74bbcb3..e9ef78cb 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp @@ -19,6 +19,7 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par 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. QTimer::singleShot(200,this, SLOT(loadButton()) ); } -- cgit From 725ca9791ec516f1bb0c5a37ec17fbedd888d928 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 13 Oct 2016 13:10:34 -0400 Subject: Another large update to lumina-fm: Have all file operations performed in the background, and show up within a new system tray icon *if* the operation lasts longer than 1 second (automatic cleanup for short ops). --- src-qt5/desktop-utils/lumina-fm/Browser.cpp | 8 +- src-qt5/desktop-utils/lumina-fm/FODialog.cpp | 10 +- src-qt5/desktop-utils/lumina-fm/FODialog.h | 8 +- src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 29 +- src-qt5/desktop-utils/lumina-fm/MainUI.h | 6 +- src-qt5/desktop-utils/lumina-fm/OPWidget.cpp | 108 ++ src-qt5/desktop-utils/lumina-fm/OPWidget.h | 59 ++ src-qt5/desktop-utils/lumina-fm/OPWidget.ui | 71 ++ src-qt5/desktop-utils/lumina-fm/TrayUI.cpp | 86 ++ src-qt5/desktop-utils/lumina-fm/TrayUI.h | 46 + src-qt5/desktop-utils/lumina-fm/lumina-fm.pro | 11 +- .../desktop-utils/lumina-fm/widgets/DirWidget.cpp | 1049 -------------------- .../desktop-utils/lumina-fm/widgets/DirWidget.h | 184 ---- .../desktop-utils/lumina-fm/widgets/DirWidget.ui | 527 ---------- 14 files changed, 413 insertions(+), 1789 deletions(-) create mode 100644 src-qt5/desktop-utils/lumina-fm/OPWidget.cpp create mode 100644 src-qt5/desktop-utils/lumina-fm/OPWidget.h create mode 100644 src-qt5/desktop-utils/lumina-fm/OPWidget.ui create mode 100644 src-qt5/desktop-utils/lumina-fm/TrayUI.cpp create mode 100644 src-qt5/desktop-utils/lumina-fm/TrayUI.h delete mode 100644 src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.cpp delete mode 100644 src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.h delete mode 100644 src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.ui diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.cpp b/src-qt5/desktop-utils/lumina-fm/Browser.cpp index 7455e5ea..72920757 100644 --- a/src-qt5/desktop-utils/lumina-fm/Browser.cpp +++ b/src-qt5/desktop-utils/lumina-fm/Browser.cpp @@ -67,12 +67,14 @@ void Browser::loadItem(QString info){ // PRIVATE SLOTS void Browser::fileChanged(QString file){ - if(file.startsWith(currentDir+"/")){ QtConcurrent::run(this, &Browser::loadItem, file ); } - else if(file==currentDir){ QTimer::singleShot(0, this, SLOT(loadDirectory()) ); } + if(file.startsWith(currentDir+"/") ){ + if(QFile::exists(file) ){ QtConcurrent::run(this, &Browser::loadItem, file ); } //file modified but not removed + else{ QTimer::singleShot(0, this, SLOT(loadDirectory()) ); } //file removed - need to update entire dir + }else if(file==currentDir){ QTimer::singleShot(0, this, SLOT(loadDirectory()) ); } } void Browser::dirChanged(QString dir){ - if(dir==currentDir){ QTimer::singleShot(0, this, SLOT(loadDirectory()) ); } + if(dir==currentDir){ QTimer::singleShot(500, this, SLOT(loadDirectory()) ); } else if(dir.startsWith(currentDir)){ QtConcurrent::run(this, &Browser::loadItem, dir ); } } diff --git a/src-qt5/desktop-utils/lumina-fm/FODialog.cpp b/src-qt5/desktop-utils/lumina-fm/FODialog.cpp index b03f1b56..ee22f832 100644 --- a/src-qt5/desktop-utils/lumina-fm/FODialog.cpp +++ b/src-qt5/desktop-utils/lumina-fm/FODialog.cpp @@ -295,17 +295,17 @@ 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] && overwrite==1){ - //Trying to copy a file/dir to itself - skip it - continue; - } if(QFile::exists(nfiles[i])){ if(overwrite!=1){ qDebug() << " - Get New Filename:" << nfiles[i]; nfiles[i] = newFileName(nfiles[i]); //prompt for new file name up front before anything starts - qDebug() << " -- nfiles[i]"; + qDebug() << " -- " << nfiles[i]; } } + if(nfiles[i] == ofiles[i] && overwrite==1){ + //Trying to copy a file/dir to itself - skip it + continue; + } QStringList subs = subfiles(ofiles[i], true); //dirs need to be first for additions for(int s=0; s #include -namespace Ui{ - class FODialog; -}; - class FOWorker : public QObject{ Q_OBJECT public: @@ -57,6 +53,10 @@ signals: void finished(QStringList); //errors returned }; +namespace Ui{ + class FODialog; +}; + class FODialog : public QDialog{ Q_OBJECT public: diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp index bac365e1..02533271 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp @@ -105,6 +105,7 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); if(DEBUG){ qDebug() << " - Devices"; } RebuildDeviceMenu(); //Make sure we start on the browser page + TRAY = new TrayUI(this); if(DEBUG){ qDebug() << " - Done with init"; } } @@ -802,28 +803,30 @@ void MainUI::PasteFiles(QString dir, QStringList raw){ newcopy<< dir+raw[i].section("::::",1,50).section("/",-1); } } - bool errs = false; + //bool errs = false; //Perform the copy/move operations - worker->pauseData = true; //pause any info requests + //worker->pauseData = true; //pause any info requests if(!copy.isEmpty()){ qDebug() << "Paste Copy:" << copy << "->" << newcopy; - FODialog dlg(this); + TRAY->StartOperation( TrayUI::COPY, copy, newcopy); + /*FODialog dlg(this); if( !dlg.CopyFiles(copy, newcopy) ){ return; } //cancelled dlg.show(); dlg.exec(); - errs = errs || !dlg.noerrors; + errs = errs || !dlg.noerrors;*/ } if(!cut.isEmpty()){ qDebug() << "Paste Cut:" << cut << "->" << newcut; - FODialog dlg(this); + TRAY->StartOperation(TrayUI::MOVE, cut, newcut); + /*FODialog dlg(this); if(!dlg.MoveFiles(cut, newcut) ){ return; } //cancelled dlg.show(); dlg.exec(); - errs = errs || !dlg.noerrors; + errs = errs || !dlg.noerrors;*/ } - worker->pauseData = false; //resume info requests + //worker->pauseData = false; //resume info requests //Modify the clipboard appropriately - if(!errs && !cut.isEmpty()){ + if(!cut.isEmpty()){ //Now clear the clipboard since those old file locations are now invalid QApplication::clipboard()->clear(); if(!copy.isEmpty()){ @@ -876,11 +879,12 @@ void MainUI::RenameFiles(QStringList list){ //Now perform the move //Don't pause the background worker for a simple rename - this operation is extremely fast qDebug() << "Rename:" << path+fname << "->" << path+nname; - FODialog dlg(this); + TRAY->StartOperation(TrayUI::MOVE, QStringList() << path+fname, QStringList() << path+nname); + /*FODialog dlg(this); dlg.setOverwrite(overwrite); dlg.MoveFiles(QStringList() << path+fname, QStringList() << path+nname); dlg.show(); - dlg.exec(); + dlg.exec();*/ } //end loop over list of files } @@ -901,11 +905,12 @@ void MainUI::RemoveFiles(QStringList list){ //Now remove the file/dir qDebug() << " - Delete: "<StartOperation(TrayUI::DELETE, paths, QStringList()); //worker->pauseData = true; //pause any info requests - FODialog dlg(this); + /*FODialog dlg(this); dlg.RemoveFiles(paths); dlg.show(); - dlg.exec(); + dlg.exec();*/ //worker->pauseData = false; //resume info requests //for(int i=0; irefresh(); } } diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.h b/src-qt5/desktop-utils/lumina-fm/MainUI.h index 94c6f6c2..0ed9c44b 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.h +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.h @@ -49,7 +49,8 @@ #include // Local includes -#include "FODialog.h" //file operation dialog +//#include "FODialog.h" //file operation dialog +#include "TrayUI.h" #include "BMMDialog.h" //bookmark manager dialog #include "DirData.h" @@ -86,7 +87,8 @@ private: QList DWLIST; MultimediaWidget *MW; SlideshowWidget *SW; - + TrayUI *TRAY; + QSettings *settings; QShortcut *nextTabLShort, *nextTabRShort, *togglehiddenfilesShort, *focusDirWidgetShort; //QCompleter *dirCompleter; diff --git a/src-qt5/desktop-utils/lumina-fm/OPWidget.cpp b/src-qt5/desktop-utils/lumina-fm/OPWidget.cpp new file mode 100644 index 00000000..3e842b90 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-fm/OPWidget.cpp @@ -0,0 +1,108 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "OPWidget.h" +#include "ui_OPWidget.h" + +OPWidget::OPWidget(QWidget *parent) : QWidget(parent), ui(new Ui::OPWidget()){ + starttime = endtime = -1; + WA = new QWidgetAction(0); + WA->setDefaultWidget(this); + worker = 0; + workthread = 0; + //Now create the widget + ui->setupUi(this); + ui->tool_close->setIcon( LXDG::findIcon("dialog-close","view-close") ); + ui->tool_showerrors->setIcon(LXDG::findIcon("view-search","")); + //connect the widget buttons + connect(ui->tool_close, SIGNAL(clicked()), this, SLOT(closeWidget()) ); + connect(ui->tool_showerrors, SIGNAL(clicked()), this, SLOT(showErrors()) ); +} + +OPWidget::~OPWidget(){ + if(worker!=0){ worker->stopped = true; worker->deleteLater(); } + if(workthread!=0){ workthread->quit(); workthread->wait(); delete workthread; } + WA->deleteLater(); +} + +QWidgetAction* OPWidget::widgetAction(){ + return WA; +} + +void OPWidget::setupOperation(QString optype, QStringList oldF, QStringList newF){ + if(workthread==0){ workthread = new QThread(); } + if(worker==0){ + worker = new FOWorker(); + connect(worker, SIGNAL(startingItem(int,int,QString,QString)), this, SLOT(opUpdate(int,int,QString,QString)) ); + connect(worker, SIGNAL(finished(QStringList)), this, SLOT(opFinished(QStringList)) ); + worker->moveToThread(workthread); + } + workthread->start(); + //Now setup the worker with the desired operation + optype = optype.toLower(); + worker->ofiles = oldF; + worker->nfiles = newF; + if(optype=="move"){ worker->isMV = true; tract = tr("Move"); } + else if(optype=="copy"){ worker->isCP = true; tract = tr("Copy"); } + else if(optype=="delete"){ worker->isRM = true; tract = tr("Remove"); } + +} + + +bool OPWidget::isDone(){ + return (endtime>0); +} + +bool OPWidget::hasErrors(){ + return !Errors.isEmpty(); +} + +float OPWidget::duration(){ + return ( (endtime-starttime)/1000.0); //convert from ms to s +} + + +QString OPWidget::finalStat(){ + return ui->label->text(); +} + + +//PUBLIC SLOTS +void OPWidget::startOperation(){ + starttime = QDateTime::currentMSecsSinceEpoch(); + endtime = -1; + QTimer::singleShot(0, worker, SLOT(slotStartOperations()) ); + emit starting(this->whatsThis()); +} + + +// PRIVATE SLOTS +void OPWidget::closeWidget(){ + if(!isDone()){ worker->stopped = true; } + else{ emit closed(this->whatsThis()); } +} + +void OPWidget::showErrors(){ + qDebug() << "Errors:" << Errors; + //TODO +} + +void OPWidget::opFinished(QStringList errors){ + Errors = errors; + endtime = QDateTime::currentMSecsSinceEpoch(); + emit finished(this->whatsThis()); + ui->progressBar->setValue(ui->progressBar->maximum()); //last item finished + ui->tool_showerrors->setVisible(!Errors.isEmpty()); + ui->label->setText( QString(tr("%1 Finished")).arg(tract) + (errors.isEmpty() ? "" : (" ("+tr("Errors Occured")+")") ) ); +} + +void OPWidget::opUpdate(int cur, int tot, QString ofile, QString nfile){ //current, total, old file, new file + ui->progressBar->setRange(0,tot); + ui->progressBar->setValue(cur); + QString txt = tract +": "+ofile.section("/",-1); + if(!nfile.isEmpty()){txt.append(" -> "+nfile.section("/",-1) ); } + ui->label->setText( txt); +} diff --git a/src-qt5/desktop-utils/lumina-fm/OPWidget.h b/src-qt5/desktop-utils/lumina-fm/OPWidget.h new file mode 100644 index 00000000..600df4b7 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-fm/OPWidget.h @@ -0,0 +1,59 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is the system tray icon for queueing/running file operations +//=========================================== +#ifndef _LUMINA_FILE_MANAGER_FILE_OP_OPWIDGET_H +#define _LUMINA_FILE_MANAGER_FILE_OP_OPWIDGET_H + +#include "FODialog.h" +namespace Ui{ + class OPWidget; +}; + +class OPWidget : public QWidget{ + Q_OBJECT +public: + OPWidget(QWidget *parent = 0); + ~OPWidget(); + + QWidgetAction* widgetAction(); //for loading the widget into a menu + + void setupOperation(QString optype, QStringList oldF, QStringList newF); + + bool isDone(); + + //Status reporting after worker finishes + bool hasErrors(); + float duration(); //in seconds + QString finalStat(); //Final status message + +public slots: + void startOperation(); + +private: + Ui::OPWidget *ui; + //Main Objects + QWidgetAction *WA; + FOWorker *worker; + QThread *workthread; + //Bookkeeping items for statistics and such + qint64 starttime, endtime; //in ms + QStringList Errors; + QString tract; //translated action + +private slots: + void closeWidget(); + void showErrors(); + void opFinished(QStringList); //errors + void opUpdate(int, int, QString, QString); //current, total, old file, new file + +signals: + void starting(QString); + void finished(QString); + void closed(QString); +}; +#endif diff --git a/src-qt5/desktop-utils/lumina-fm/OPWidget.ui b/src-qt5/desktop-utils/lumina-fm/OPWidget.ui new file mode 100644 index 00000000..3daafaf2 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-fm/OPWidget.ui @@ -0,0 +1,71 @@ + + + OPWidget + + + + 0 + 0 + 202 + 67 + + + + Form + + + + 2 + + + 2 + + + 2 + + + 2 + + + + + 0 + + + -1 + + + + + + + + + ... + + + + + + + ... + + + + + + + + + Evaluating... + + + Qt::AlignCenter + + + + + + + + diff --git a/src-qt5/desktop-utils/lumina-fm/TrayUI.cpp b/src-qt5/desktop-utils/lumina-fm/TrayUI.cpp new file mode 100644 index 00000000..8e796c68 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-fm/TrayUI.cpp @@ -0,0 +1,86 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "TrayUI.h" + +#include +#include + +TrayUI::TrayUI(QObject *parent) : QSystemTrayIcon(parent){ + this->setContextMenu( new QMenu() ); + this->setIcon(LXDG::findIcon("Insight-FileManager","")); +} + +TrayUI::~TrayUI(){ + this->contextMenu()->deleteLater(); +} + +void TrayUI::StartOperation( FILEOP op, QStringList oldF, QStringList newF){ + createOP(op, oldF, newF); + QTimer::singleShot(1000, this, SLOT(checkJobs())); +} + +void TrayUI::createOP( FILEOP type, QStringList oldF, QStringList newF){ + OPWidget *OP = new OPWidget(); + if(type==MOVE){ OP->setupOperation("move", oldF, newF); } + else if(type==COPY){ OP->setupOperation("copy", oldF, newF); } + else if(type==DELETE){ OP->setupOperation("delete",oldF, QStringList()); } + else{ OP->deleteLater(); return; } //invalid type of operation + OP->setWhatsThis( QUuid::createUuid().toString() ); + this->contextMenu()->addAction(OP->widgetAction()); + OPS << OP; + connect(OP, SIGNAL(starting(QString)), this, SLOT(OperationStarted(QString)) ); + connect(OP, SIGNAL(finished(QString)), this, SLOT(OperationFinished(QString)) ); + connect(OP, SIGNAL(closed(QString)), this, SLOT(OperationClosed(QString)) ); + QTimer::singleShot(0, OP, SLOT(startOperation()) ); +} + +//Operation Widget Responses +void TrayUI::OperationClosed(QString ID){ + for(int i=0; iwhatsThis()==ID){ + //qDebug() << "Removing OPWidget:" << ID; + //this->contextMenu()->removeAction(OPS[i]->widgetAction()); + OPS.takeAt(i)->deleteLater(); + break; + } + } + QTimer::singleShot(1000, this, SLOT(checkJobs()) ); +} + +void TrayUI::OperationStarted(QString ID){ + for(int i=0; iwhatsThis()==ID){ + //NOTHING FOR NOW - ENABLE POPUPS LATER (if desired - they can get annoying for short operations) + } + } +} + +void TrayUI::OperationFinished(QString ID){ + //qDebug() << "Op Finished:" << ID; + for(int i=0; iwhatsThis()!=ID){ continue; } + //qDebug() << " - found widget"; + bool err = OPS[i]->hasErrors(); + //qDebug() << " -- Errors:" << err << "Duration:" << OPS[i]->duration(); + //Assemble the notification (if more than 1 second to perform operation) + if(OPS[i]->duration()>1){ + this->showMessage( tr("Finished"), err ? tr("Errors during operation. Click to view details") : tr("No Errors"), err ? QSystemTrayIcon::Warning : QSystemTrayIcon::Information); + } + //Close the widget if no errors + if(!err){ OperationClosed(ID); } + break; + } +} + +void TrayUI::checkJobs(){ + if(OPS.isEmpty()){ + emit JobsFinished(); + this->hide(); + }else{ + this->show(); + } +} diff --git a/src-qt5/desktop-utils/lumina-fm/TrayUI.h b/src-qt5/desktop-utils/lumina-fm/TrayUI.h new file mode 100644 index 00000000..38a99f7a --- /dev/null +++ b/src-qt5/desktop-utils/lumina-fm/TrayUI.h @@ -0,0 +1,46 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is the system tray icon for queueing/running file operations +//=========================================== +#ifndef _LUMINA_FILE_MANAGER_FILE_OP_SYSTRAY_H +#define _LUMINA_FILE_MANAGER_FILE_OP_SYSTRAY_H + +#include "OPWidget.h" + +#include +#include + +class TrayUI : public QSystemTrayIcon{ + Q_OBJECT +public: + enum FILEOP{MOVE, COPY, DELETE}; //File Operations + + TrayUI(QObject *parent = 0); + ~TrayUI(); + +public slots: + void StartOperation( FILEOP op, QStringList oldF, QStringList newF); + +private: + QList OPS; + + void createOP( FILEOP, QStringList oldF, QStringList newF); + +private slots: + + //Operation Widget Responses + void OperationClosed(QString ID); + void OperationStarted(QString ID); + void OperationFinished(QString ID); + + void checkJobs(); //see if any jobs are still active/visible, otherwise hide the tray icon + +signals: + void JobsFinished(); + +}; +#endif diff --git a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro index 8fb482c7..92042ad7 100644 --- a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro +++ b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro @@ -19,7 +19,9 @@ SOURCES += main.cpp \ gitCompat.cpp \ gitWizard.cpp \ Browser.cpp \ - BrowserWidget.cpp + BrowserWidget.cpp \ + TrayUI.cpp \ + OPWidget.cpp HEADERS += MainUI.h \ FODialog.h \ @@ -33,7 +35,9 @@ HEADERS += MainUI.h \ gitCompat.h \ gitWizard.h \ Browser.h \ - BrowserWidget.h + BrowserWidget.h \ + TrayUI.h \ + OPWidget.h FORMS += MainUI.ui \ FODialog.ui \ @@ -41,7 +45,8 @@ FORMS += MainUI.ui \ widgets/MultimediaWidget.ui \ widgets/SlideshowWidget.ui \ widgets/DirWidget2.ui \ - gitWizard.ui + gitWizard.ui \ + OPWidget.ui icons.files = Insight-FileManager.png icons.path = $${L_SHAREDIR}/pixmaps diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.cpp deleted file mode 100644 index d729d608..00000000 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.cpp +++ /dev/null @@ -1,1049 +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 "DirWidget.h" -#include "ui_DirWidget.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "../ScrollDialog.h" - -#define DEBUG 0 - - -const QString sessionsettings_config_file = QDir::homePath() + "/.config/lumina-desktop/sessionsettings.conf"; - -DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new Ui::DirWidget){ - ui->setupUi(this); //load the designer file - ID = objID; - //Assemble the toolbar for the widget - toolbar = new QToolBar(this); - toolbar->setContextMenuPolicy(Qt::CustomContextMenu); - toolbar->setFloatable(false); - toolbar->setMovable(false); - toolbar->setOrientation(Qt::Horizontal); - toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); - //toolbar->setIconSize(QSize(32,32)); - ui->toolbar_layout->addWidget(toolbar); - // - Add the buttons to the toolbar - toolbar->addAction(ui->actionBack); - toolbar->addAction(ui->actionUp); - toolbar->addAction(ui->actionHome); - line_dir = new QLineEdit(this); - toolbar->addWidget(line_dir); - toolbar->addAction(ui->actionStopLoad); - toolbar->addAction(ui->actionClose_Browser); - //Add the browser widgets - listWidget = new DDListWidget(this); - treeWidget = new DDTreeWidget(this); - ui->browser_layout->addWidget(listWidget); - ui->browser_layout->addWidget(treeWidget); - //Create the keyboard shortcuts - /*copyFilesShort = new QShortcut( QKeySequence(tr("Ctrl+C")), this); - pasteFilesShort = new QShortcut( QKeySequence(tr("Ctrl+V")), this); - cutFilesShort = new QShortcut( QKeySequence(tr("Ctrl+X")), this); - deleteFilesShort = new QShortcut( QKeySequence(tr("Delete")), this);*/ - //Create the filesystem watcher - watcher = new QFileSystemWatcher(this); - synctimer = new QTimer(this); - synctimer->setInterval(300); // 300 millisecond pause (combine simultaneous signals from the watcher) - synctimer->setSingleShot(true); - //Now update the rest of the UI - canmodify = false; //initial value - contextMenu = new QMenu(this); - setDateFormat(); - setShowDetails(true); - setShowThumbnails(true); - UpdateIcons(); - UpdateText(); - setupConnections(); -} - -DirWidget::~DirWidget(){ - stopload = true; //just in case another thread is still loading/running -} - -void DirWidget::setFocusLineDir() { - line_dir->setFocus(); - line_dir->selectAll(); -} - -void DirWidget::cleanup(){ - stopload = true; //just in case another thread is still loading/running - if(thumbThread.isRunning()){ thumbThread.waitForFinished(); } //this will stop really quickly with the flag set -} - -void DirWidget::ChangeDir(QString dirpath){ - stopload = true; //just in case it is still loading - emit LoadDirectory(ID, dirpath); -} - -void DirWidget::setDirCompleter(QCompleter *comp){ - //line_dir->setCompleter(comp); -} - -QString DirWidget::id(){ - return ID; -} - -QString DirWidget::currentDir(){ - return CDIR; -} - -void DirWidget::setShowDetails(bool show){ - if(show!=showDetails){ - //View about to change - ensure the selection gets transferred too - tmpSel = currentSelection(); - } - showDetails = show; - listWidget->setVisible(!showDetails); - treeWidget->setVisible(showDetails); - this->refresh(); -} - -void DirWidget::setShowSidebar(bool show){ - ui->group_actions->setVisible(show); -} - -void DirWidget::setShowThumbnails(bool show){ - showThumbs = show; - this->refresh(); -} - -void DirWidget::setDetails(QList list){ - listDetails = list; - //Need to re-create the header item as well - CQTreeWidgetItem *it = new CQTreeWidgetItem(); - int nmcol = -1; int typecol = -1; - for(int t=0; tsetText(t,tr("Name")); - nmcol = t; - break; - case SIZE: - it->setText(t,tr("Size")); - break; - case TYPE: - it->setText(t, tr("Type")); - typecol = t; - break; - case DATEMOD: - it->setText(t, tr("Date Modified") ); - break; - case DATECREATE: - it->setText(t, tr("Date Created") ); - break; - } - } - treeWidget->setHeaderItem(it); - //Now reset the sorting (alphabetically, dirs first) - if(nmcol>=0){ treeWidget->sortItems(nmcol, Qt::AscendingOrder); } // sort by name - if(typecol>=0){ treeWidget->sortItems(typecol, Qt::AscendingOrder); } //sort by type first - - if(CDIR.isEmpty() || !showDetails){ return; } //don't need to reload dir if details are not visible - this->refresh(); -} - -void DirWidget::setThumbnailSize(int px){ - bool larger = listWidget->iconSize().height() < px; - listWidget->setIconSize(QSize(px,px)); - treeWidget->setIconSize(QSize(px,px)); - if(CDIR.isEmpty() || !larger ){ return; } //don't need to reload icons unless the new size is larger - this->refresh(); -} - -void DirWidget::setShowCloseButton(bool show){ - ui->actionClose_Browser->setVisible(show); -} - -QStringList DirWidget::getDateFormat() { - return date_format; -} - -// This function is only called if user changes sessionsettings. By doing so, operations like sorting by date -// are faster because the date format is already stored in DirWidget::date_format static variable -void DirWidget::setDateFormat() { - if(!date_format.isEmpty()) - date_format.clear(); - QSettings settings("lumina-desktop","sessionsettings"); - // If value doesn't exist or is not setted, empty string is returned - date_format << settings.value("DateFormat").toString(); - date_format << settings.value("TimeFormat").toString(); -} - - -// ================ -// PUBLIC SLOTS -// ================ -void DirWidget::LoadDir(QString dir, QList list){ - if(dir.isEmpty()){ return; } //nothing to do - QTime time; - if(DEBUG){time.start(); } - qDebug() << "Load Dir:" << dir; - QString lastdir = CDIR; //for some checks later - QString lastbasedir = normalbasedir; - CDIR = dir; - if(CDIR.endsWith("/") && CDIR.length() > 1){ CDIR.chop(1); } - CLIST = list; //save for later - canmodify = QFileInfo(CDIR).isWritable(); - if(DEBUG){ qDebug() << "Clear UI:" <label_status->setText(tr("(Limited Access) ")); } - else{ ui->label_status->setText(""); } - //Hide the extra buttons for a moment - ui->tool_goToPlayer->setVisible(false); - ui->tool_goToImages->setVisible(false); - ui->tool_new_dir->setVisible(canmodify); - ui->tool_new_file->setVisible(canmodify); - //Set the drag/drop info as appripriate - if(canmodify){ - listWidget->setWhatsThis(CDIR); - treeWidget->setWhatsThis(CDIR); - }else{ - listWidget->setWhatsThis(""); - treeWidget->setWhatsThis(""); - } - bool updateThumbs = (lastdir != CDIR); - //Determine if this is an internal ZFS snapshot - bool loadsnaps = false; - if(DEBUG){ qDebug() << "Load Snap Info:" << time.elapsed(); } - if( dir.contains(ZSNAPDIR) ){ - //This is a zfs snapshot - only update the saved paths necessary to rotate between snapshots/system - snaprelpath = dir.section(ZSNAPDIR,1,1000).section("/",1,1000); //the relative path inside the snapshot - if(snaprelpath.endsWith("/")){ snaprelpath.chop(1); } - normalbasedir = dir.section(ZSNAPDIR,0,0)+"/"+snaprelpath; //Update the new base directory - if(normalbasedir.endsWith("/")){ normalbasedir.chop(1); } - line_dir->setText(normalbasedir); - //See if this was a manual move to the directory, or an internal move - QString tmp = dir.section(ZSNAPDIR,0,0); - if(tmp != snapbasedir.section(ZSNAPDIR,0,0)){ - loadsnaps = true; //different snapshot loaded - need to update internally - } - }else{ - //This is a normal directory - prompt for snapshot information - line_dir->setText(CDIR); - normalbasedir = CDIR; - if(!snapbasedir.isEmpty()){ watcher->removePath(snapbasedir); } - snapbasedir.clear(); - loadsnaps = true; - } - if(loadsnaps){ - //kick this off while still loading the dir contents - ui->group_snaps->setEnabled(false); //to prevent the snap updates to be automatically used - ui->group_snaps->setVisible(false); - ui->slider_snap->setRange(1,1); - emit findSnaps(ID, normalbasedir); - } - - if(DEBUG){ qDebug() << "Update History:" <actionBack->setEnabled(!history.isEmpty()); - //qDebug() << " - Duplicate: removed item"; - }else if(lastbasedir!=normalbasedir){ //not a refresh or internal snapshot change - //qDebug() << " - New History Item:" << normalbasedir; - history << normalbasedir; - ui->actionBack->setEnabled(history.length()>1); - } - if(DEBUG){ qDebug() << "Update Watcher:" << time.elapsed(); } - //Clear the current watcher - if(!watcher->directories().isEmpty()){ watcher->removePaths(watcher->directories()); } - if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); } - watcher->addPath(CDIR); - // add sessionsettings to watcher so date_format can be update based on user settings - watcher->addPath(sessionsettings_config_file); - ui->actionStopLoad->setVisible(true); - stopload = false; - //Clear the display widget (if a new directory) - if(DEBUG){ qDebug() << "Clear Browser Widget:" << time.elapsed(); } - double scrollpercent = -1; - if(updateThumbs){ needThumbs.clear(); } - if(lastbasedir != normalbasedir){ - if(showDetails){ treeWidget->clear(); } - else{ listWidget->clear(); } - QApplication::processEvents(); //make sure it is cleared right away - }else{ - //Need to be smarter about which items need to be removed - // - compare the old/new lists and remove any items not in the new listing (new items taken care of below) - QStringList newfiles; //just the filenames - for(int i=0; itopLevelItemCount(); i++){ - if( !newfiles.contains(treeWidget->topLevelItem(i)->whatsThis(0).section("/",-1)) ){ - if(!updateThumbs){ needThumbs.removeAll( treeWidget->topLevelItem(i)->whatsThis(0).section("::::",1,50)); } - delete treeWidget->takeTopLevelItem(i); - i--; - } - } - QApplication::processEvents(); //make sure the scrollbar is up to date after removals - scrollpercent = treeWidget->verticalScrollBar()->value()/( (double) treeWidget->verticalScrollBar()->maximum()); - }else{ - for(int i=0; icount(); i++){ - if( !newfiles.contains(listWidget->item(i)->text()) ){ - if(!updateThumbs){ needThumbs.removeAll( listWidget->item(i)->whatsThis().section("::::",1,50)); } - delete listWidget->takeItem(i); - i--; - } - } - QApplication::processEvents(); //make sure the scrollbar is up to date after removals - scrollpercent = listWidget->horizontalScrollBar()->value()/( (double) listWidget->horizontalScrollBar()->maximum()); - } - } //end check for CDIR reload - //Now fill the display widget - bool hasimages, hasmultimedia; - hasimages = hasmultimedia = false; - int numdirs = 0; - qint64 filebytes = 0; - //Setup the timer to see when we should process events - /*QTimer updatetime; - updatetime.setInterval(1000); //1 second updates - updatetime.setSingleShot(true); - updatetime.start();*/ - QTime updatetime = QTime::currentTime().addMSecs(500); - if(DEBUG){ qDebug() << "Start Loop over items:" << time.elapsed(); } - for(int i=0; iactionStopLoad->setVisible(false); return; } //stop right now - if(!hasimages && list[i].isImage()){ hasimages = true; ui->tool_goToImages->setVisible(true); } - else if(!hasmultimedia && list[i].isAVFile()){ hasmultimedia = true; ui->tool_goToPlayer->setVisible(true); } - //Update statistics - if(list[i].isDir()){ numdirs++; } - else{ filebytes += list[i].size(); } - watcher->addPath(list[i].absoluteFilePath()); - if(showDetails){ - //Now create all the individual items for the details tree - CQTreeWidgetItem *it; - bool addnew = false; - //See if an item already exists for this file - QList items = treeWidget->findItems(list[i].fileName(),Qt::MatchExactly,0); //NOTE: This requires column 0 to be the name - if(items.isEmpty()){ - it = new CQTreeWidgetItem(); - addnew = true; - }else{ - // Safe downcasting because CQTreeWidgetItem only redefines the virtual function bool opearot<. Not new methos added. - it = static_cast (items.first()); - } - //Now update the entry contents - it->setWhatsThis(0, QString(canmodify ? "cut": "copy")+"::::"+list[i].absoluteFilePath()); - for(int t=0; tsetText(t,list[i].fileName()); - it->setStatusTip(t, list[i].fileName()); - //Since the icon/image is based on the filename - only update this for a new item - // (This is the slowest part of the routine) - if(list[i].isImage()&& (addnew || updateThumbs)){ - if(showThumbs){ - it->setIcon(t, LXDG::findIcon("fileview-preview","image-x-generic") ); - needThumbs << list[i].absoluteFilePath(); - }else{ it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); } - }else if(addnew){ - it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"unknown") ); - } - break; - case SIZE: - if(!list[i].isDir()){ - it->setText(t, LUtils::BytesToDisplaySize(list[i].size()) ); - } - break; - case TYPE: - it->setText(t, list[i].mimetype()); - break; - case DATEMOD: - { - QStringList datetime_format = getDateFormat(); - // Save datetime in WhatThis value. Lately will be used by CQTreeWidgetItem for sorting by date - it->setWhatsThis(t, list[i].lastModified().toString("yyyyMMddhhmmsszzz")); - // Default configurition. Fallback to Qt::DefaultLocaleShortDate for formats - if(datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty()) - it->setText(t, list[i].lastModified().toString(Qt::DefaultLocaleShortDate) ); - // Date is setted but time not. Time goes to default - else if(!datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty()) - it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(Qt::DefaultLocaleShortDate)); - // Time is setted but date not. Date goes to default - else if(datetime_format.at(0).isEmpty() && !datetime_format.at(1).isEmpty()) - it->setText(t, list[i].lastModified().date().toString(Qt::DefaultLocaleShortDate) + " " + list[i].lastModified().time().toString(datetime_format.at(1))); - // Both time and date setted. - else - it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(datetime_format.at(1))); - break; - } - case DATECREATE: - { - QStringList datetime_format = getDateFormat(); - it->setWhatsThis(DATECREATE, list[i].lastModified().toString("yyyyMMddhhmmsszzz")); - if(datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty()) - it->setText(t, list[i].lastModified().toString(Qt::DefaultLocaleShortDate) ); - else if(!datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty()) - it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(Qt::DefaultLocaleShortDate)); - else if(datetime_format.at(0).isEmpty() && !datetime_format.at(1).isEmpty()) - it->setText(t, list[i].lastModified().date().toString(Qt::DefaultLocaleShortDate) + " " + list[i].lastModified().time().toString(datetime_format.at(1))); - else - it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(datetime_format.at(1))); - break; - } - } - } - if(addnew){ treeWidget->addTopLevelItem(it); } - if(tmpSel.contains(list[i].absoluteFilePath())){ it->setSelected(true); } - if(lastdir == CDIR+"/"+list[i].fileName()){ - treeWidget->setCurrentItem(it); - treeWidget->scrollToItem(it); - } - }else{ - //Create all the individual items for the basic list - QListWidgetItem *it; - //See if there is an existing item to re-use - bool addnew = false; - QList items = listWidget->findItems(list[i].fileName(), Qt::MatchExactly); - if(items.isEmpty()){ - it = new QListWidgetItem(); - addnew = true; - }else{ it = items.first(); } - - it->setWhatsThis( QString(canmodify ? "cut": "copy")+"::::"+list[i].absoluteFilePath()); //used for drag and drop - it->setText(list[i].fileName()); - it->setStatusTip(list[i].fileName()); - //Since the icon/image is based on the filename - only update this for a new items (non-thumbnail) - // (This is the slowest part of the routine) - if(list[i].isImage() && (addnew || updateThumbs) ){ - if(showThumbs){ - it->setIcon(LXDG::findIcon("fileview-preview","image-x-generic") ); - needThumbs << list[i].absoluteFilePath(); - }else{ it->setIcon(LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); } - }else if(addnew){ - it->setIcon(LXDG::findIcon(list[i].iconfile(),"unknown") ); - } - listWidget->addItem(it); - if(tmpSel.contains(list[i].absoluteFilePath())){ it->setSelected(true); } - if(lastdir == CDIR+"/"+list[i].fileName()){ - listWidget->setCurrentItem(it); - listWidget->scrollToItem(it); - } - } - if(QTime::currentTime() > updatetime){ QApplication::processEvents(); updatetime = QTime::currentTime().addMSecs(500); }//keep the UI snappy while loading a directory - if(DEBUG){ qDebug() << " - item finished:" << i << time.elapsed(); } - } - tmpSel.clear(); - if(DEBUG){ qDebug() << "Done with item loop:" << time.elapsed() << list.length(); } - ui->actionStopLoad->setVisible(false); - //Another check to ensure the current item is visible (or return to the same scroll position) - if(stopload){ return; } //stop right now - if(scrollpercent<0){ - if(showDetails){ - for(int t=0; tcolumnCount(); t++){treeWidget->resizeColumnToContents(t); } - if(treeWidget->currentItem()!=0){ treeWidget->scrollToItem(treeWidget->currentItem()); } - }else{ - if(listWidget->currentItem()!=0){ listWidget->scrollToItem(listWidget->currentItem()); } - } - }else{ - if(showDetails){ - treeWidget->verticalScrollBar()->setValue( qRound(treeWidget->verticalScrollBar()->maximum()*scrollpercent) ); - }else{ - listWidget->horizontalScrollBar()->setValue( qRound(listWidget->horizontalScrollBar()->maximum()*scrollpercent) ); - } - } - - - if(stopload){ return; } //stop right now - if(DEBUG){ qDebug() << "Assemble Status Message:" << time.elapsed(); } - //Assemble any status message - QString stats = QString(tr("Capacity: %1")).arg(LOS::FileSystemCapacity(CDIR)); - if(list.length()>0){ - stats.prepend("\t"); - if(numdirs < list.length()){ - //Has Files - stats.prepend( QString(tr("Files: %1 (%2)")).arg(QString::number(list.length()-numdirs), LUtils::BytesToDisplaySize(filebytes)) ); - } - if(numdirs > 0){ - //Has Dirs - if(numdirslabel_status->setText( stats.simplified() ); - if(DEBUG){ qDebug() << "DONE:" << time.elapsed(); } - if(showThumbs){ thumbThread = QtConcurrent::run(this, &DirWidget::startLoadThumbs); } -} - -void DirWidget::LoadSnaps(QString basedir, QStringList snaps){ - //Save these value internally for use later - qDebug() << "ZFS Snapshots available:" << basedir << snaps; - snapbasedir = basedir; - snapshots = snaps; - if(!snapbasedir.isEmpty()){ watcher->addPath(snapbasedir); } //add this to the watcher in case snapshots get created/removed - //Now update the UI as necessary - if(ui->tool_snap->menu()==0){ - ui->tool_snap->setMenu(new QMenu(this)); - connect(ui->tool_snap->menu(), SIGNAL(triggered(QAction*)), this, SLOT(direct_snap_selected(QAction*)) ); - } - ui->tool_snap->menu()->clear(); - for(int i=0; itool_snap->menu()->addAction(snapshots[i]); - tmp->setWhatsThis(snapshots[i]); - } - ui->slider_snap->setRange(0, snaps.length()); - if(CDIR.contains(ZSNAPDIR)){ - //The user was already within a snapshot - figure out which one and set the slider appropriately - int index = snaps.indexOf( CDIR.section(ZSNAPDIR,1,1).section("/",0,0) ); - if(index < 0){ index = snaps.length(); } //unknown - load the system (should never happen) - ui->slider_snap->setValue(index); - }else{ - ui->slider_snap->setValue(snaps.length()); //last item (normal system) - } - on_slider_snap_valueChanged(); - QApplication::processEvents(); //let the slider changed signal get thrown away before we re-enable the widget - ui->group_snaps->setEnabled(!snaps.isEmpty()); - ui->group_snaps->setVisible(!snaps.isEmpty()); - ui->tool_snap_newer->setEnabled(ui->slider_snap->value() < ui->slider_snap->maximum()); - ui->tool_snap_older->setEnabled(ui->slider_snap->value() > ui->slider_snap->minimum()); -} - -void DirWidget::refresh(){ - if(!CDIR.isEmpty() && ~ID.isEmpty()){ - stopload = true; //just in case it is still loading - emit LoadDirectory(ID, CDIR); - } -} - -void DirWidget::refreshButtons(){ - SelectionChanged(); -} - -//Theme change functions -void DirWidget::UpdateIcons(){ - //ui->tool_addNewFile->setIcon( LXDG::findIcon("document-new","")); - //ui->tool_addToDir->setIcon( LXDG::findIcon("folder-new","") ); - - //Snapshot buttons - ui->tool_snap_newer->setIcon(LXDG::findIcon("go-next-view","") ); - ui->tool_snap_older->setIcon(LXDG::findIcon("go-previous-view","") ); - //Bottom-Action Buttons - ui->tool_goToImages->setIcon( LXDG::findIcon("fileview-preview","") ); - ui->tool_goToPlayer->setIcon( LXDG::findIcon("applications-multimedia","") ); - ui->tool_new_file->setIcon( LXDG::findIcon("document-new","") ); - ui->tool_new_dir->setIcon( LXDG::findIcon("folder-new","") ); - //Side-Action Buttons - ui->tool_act_run->setIcon( LXDG::findIcon("run-build-file","") ); - ui->tool_act_runwith->setIcon( LXDG::findIcon("run-build-configure","") ); - ui->tool_act_cut->setIcon( LXDG::findIcon("edit-cut","") ); - ui->tool_act_copy->setIcon( LXDG::findIcon("edit-copy","") ); - ui->tool_act_paste->setIcon( LXDG::findIcon("edit-paste","") ); - ui->tool_act_rename->setIcon( LXDG::findIcon("edit-rename","") ); - ui->tool_act_rm->setIcon( LXDG::findIcon("edit-delete","") ); - ui->tool_act_fav->setIcon( LXDG::findIcon("bookmark-toolbar","") ); - //ToolBar Buttons - ui->actionBack->setIcon( LXDG::findIcon("go-previous","") ); - ui->actionUp->setIcon( LXDG::findIcon("go-up","") ); - ui->actionHome->setIcon( LXDG::findIcon("go-home","") ); - ui->actionStopLoad->setIcon( LXDG::findIcon("dialog-cancel","") ); - ui->actionClose_Browser->setIcon( LXDG::findIcon("dialog-close","") ); -} - -void DirWidget::UpdateText(){ - ui->retranslateUi(this); -} - -void DirWidget::UpdateButtons(){ - SelectionChanged(); -} - -//Keyboard Shortcuts triggered -void DirWidget::TryRenameSelection(){ - on_tool_act_rename_clicked(); -} - -void DirWidget::TryCutSelection(){ - on_tool_act_cut_clicked(); -} - -void DirWidget::TryCopySelection(){ - on_tool_act_copy_clicked(); -} - -void DirWidget::TryPasteSelection(){ - on_tool_act_paste_clicked(); -} - -void DirWidget::TryDeleteSelection(){ - on_tool_act_rm_clicked(); -} - -// ================= -// PRIVATE -// ================= -void DirWidget::setupConnections(){ - //Info routines - connect(treeWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) ); - connect(listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) ); - connect(treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) ); - connect(listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) ); - - //Activation routines - connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(on_tool_act_run_clicked()) ); - connect(treeWidget, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) ); - connect(listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(on_tool_act_run_clicked()) ); - connect(listWidget, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) ); - connect(line_dir, SIGNAL(returnPressed()), this, SLOT(dir_changed()) ); - - //Keyboard Shortcuts - /*connect(copyFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_copy_clicked() ) ); - connect(cutFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_cut_clicked() ) ); - connect(pasteFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_paste_clicked() ) ); - connect(deleteFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_rm_clicked() ) );*/ - - //Filesystem Watcher - connect(watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(startSync(const QString &)) ); - connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(startSync(const QString &)) ); //just in case - connect(synctimer, SIGNAL(timeout()), this, SLOT(refresh()) ); - - //Thumbnail loader - connect(this, SIGNAL(ThumbLoaded(QString, QIcon)), this, SLOT(showThumb(QString, QIcon)) ); -} - -QStringList DirWidget::currentSelection(){ - QStringList out; - if(showDetails){ - QList sel = treeWidget->selectedItems(); - for(int i=0; iwhatsThis(0).section("::::",1,100); //absolute file path - } - }else{ - QList sel = listWidget->selectedItems(); - for(int i=0; iwhatsThis().section("::::",1,100); //absolute file path - } - } - out.removeDuplicates(); - return out; -} - -// ================= -// PRIVATE SLOTS -// ================= -void DirWidget::startLoadThumbs(){ - //This just runs through the dir and loads all the thumbnails as needed - if(DEBUG){ qDebug() << "Start Loading Thumbnails:" << needThumbs; } - if(needThumbs.isEmpty()){ return; } - needThumbs.removeDuplicates(); //just in case - //QTime updatetime = QTime::currentTime().addMSecs(500); - while(!needThumbs.isEmpty() && !stopload){ - QString file = needThumbs.takeFirst(); - QIcon ico(QPixmap(file).scaled(listWidget->iconSize(),Qt::IgnoreAspectRatio, Qt::FastTransformation) ); - emit ThumbLoaded(file, ico); - } -} - -void DirWidget::showThumb(QString file, QIcon ico){ - if(showDetails){ - //Use the tree widget - QList items = treeWidget->findItems(file.section("/",-1), Qt::MatchExactly); - if(items.isEmpty() || stopload){ return; } //invalid item for some reason - QTreeWidgetItem *it = items.first(); - it->setIcon(0, ico ); - }else{ - //Use the list widget - QList items = listWidget->findItems(file.section("/",-1), Qt::MatchExactly); - if(items.isEmpty() || stopload){ return; } //invalid item for some reason - if(stopload){ return; } //stop right now - QListWidgetItem *it = items.first(); - it->setIcon(ico); - } -} - -//UI BUTTONS -// -- Left Action Buttons -void DirWidget::on_tool_act_cut_clicked(){ - QStringList sel = currentSelection(); - qDebug() << "Cutting Items to clipboard:" << sel; - if(sel.isEmpty()){ return; } - emit CutFiles(sel); -} - -void DirWidget::on_tool_act_copy_clicked(){ - QStringList sel = currentSelection(); - if(sel.isEmpty()){ return; } - qDebug() << "Copying Items to clipboard:" << sel; - emit CopyFiles(sel); -} - -void DirWidget::on_tool_act_fav_clicked(){ - QStringList sel = currentSelection(); - if(sel.isEmpty()){ return; } - - emit FavoriteFiles(sel); -} - -void DirWidget::on_tool_act_paste_clicked(){ - qDebug() << "Pasting Items from clipboard:" << CDIR; - emit PasteFiles(CDIR, QStringList()); //use the clipboard for pasting -} - -void DirWidget::on_tool_act_rename_clicked(){ - QStringList sel = currentSelection(); - if(sel.isEmpty()){ return; } - emit RenameFiles(sel); -} - -void DirWidget::on_tool_act_rm_clicked(){ - QStringList sel = currentSelection(); - if(sel.isEmpty()){ return; } - qDebug() << "Deleting selected Items:" << sel; - emit RemoveFiles(sel); -} - -void DirWidget::on_tool_act_run_clicked(){ - QStringList sel = currentSelection(); - if(sel.isEmpty()){ return; } - QStringList dirs; - for(int i=0; iisActive()){ synctimer->start(); } -} - -void DirWidget::on_tool_new_dir_clicked(){ - if(!canmodify){ return; } //cannot create anything here - //Prompt for the new dir name - bool ok = false; - QString newdir = QInputDialog::getText(this, tr("New Directory"), tr("Name:"), QLineEdit::Normal, "", \ - &ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly); - if(!ok || newdir.isEmpty()){ return; } - //Now create the new dir - QString full = CDIR; - if(!full.endsWith("/")){ full.append("/"); } - QDir dir(full); //open the current dir - full.append(newdir); //append the new name to the current dir - //Verify that the new dir does not already exist - if(dir.exists(full)){ - QMessageBox::warning(this, tr("Invalid Name"), tr("A file or directory with that name already exists! Please pick a different name.")); - QTimer::singleShot(0,this, SLOT(on_tool_addToDir_clicked()) ); //repeat this function - }else{ - if(!dir.mkdir(newdir) ){ - QMessageBox::warning(this, tr("Error Creating Directory"), tr("The directory could not be created. Please ensure that you have the proper permissions to modify the current directory.")); - } - } - //just in case the watcher does not work for this filesystem -queue up a sync - if(!synctimer->isActive()){ synctimer->start(); } -} - -// -- Top Snapshot Buttons -void DirWidget::on_tool_snap_newer_clicked(){ - ui->slider_snap->setValue( ui->slider_snap->value()+1 ); -} - -void DirWidget::on_tool_snap_older_clicked(){ - ui->slider_snap->setValue( ui->slider_snap->value()-1 ); -} - -void DirWidget::on_slider_snap_valueChanged(int val){ - bool labelsonly = false; - if(val==-1){ val = ui->slider_snap->value(); labelsonly=true; } - //Update the snapshot interface - ui->tool_snap_newer->setEnabled(val < ui->slider_snap->maximum()); - ui->tool_snap_older->setEnabled(val > ui->slider_snap->minimum()); - if(val >= snapshots.length() || val < 0){ - ui->tool_snap->setText(tr("Current")); - }else if(QFile::exists(snapbasedir+snapshots[val])){ - ui->tool_snap->setText( QFileInfo(snapbasedir+snapshots[val]).lastModified().toString(Qt::DefaultLocaleShortDate) ); - } - //Exit if a non-interactive snapshot change - if(!ui->group_snaps->isEnabled() || labelsonly){ return; } //internal change - do not try to change the actual info - //Determine which snapshot is now selected - QString dir; - if(DEBUG){ qDebug() << "Changing snapshot:" << CDIR << val << snapbasedir; } - stopload = true; //stop any currently-loading procedures - if(val >= snapshots.length() || val < 0){ //active system selected - if(DEBUG){ qDebug() << " - Load Active system:" << normalbasedir; } - dir = normalbasedir; - }else{ - dir = snapbasedir+snapshots[val]+"/"; - if(!QFile::exists(dir)){ - //This snapshot must have been removed in the background by pruning tools - // move to a newer snapshot or the current base dir as necessary - qDebug() << "Snapshot no longer available:" << dir; - qDebug() << " - Reloading available snapshots"; - emit findSnaps(ID, normalbasedir); - return; - } - //if(snaprelpath.isEmpty()){ - //Need to figure out the relative path within the snapshot - snaprelpath = normalbasedir.section(snapbasedir.section(ZSNAPDIR,0,0), 1,1000); - if(DEBUG){ qDebug() << " - new snapshot-relative path:" << snaprelpath; } - //} - dir.append(snaprelpath); - dir.replace("//","/"); //just in case any duplicate slashes from all the split/combining - if(DEBUG){ qDebug() << " - Load Snapshot:" << dir; } - } - //Make sure this directory exists, and back up as necessary - if(dir.isEmpty()){ return; } - //Load the newly selected snapshot - stopload = true; //just in case it is still loading - emit LoadDirectory(ID, dir); -} - -void DirWidget::direct_snap_selected(QAction *act){ - QString snap = act->whatsThis(); - int val = snapshots.indexOf(snap); - if(val<0){ return; } - else{ ui->slider_snap->setValue(val); } -} - -//Top Toolbar buttons -void DirWidget::on_actionBack_triggered(){ - if(history.isEmpty()){ return; } //cannot do anything - QString dir = history.takeLast(); - //qDebug() << "Go Back:" << dir << normalbasedir << history.last(); - if(dir == normalbasedir){ - dir = history.takeLast(); - } - stopload = true; //just in case it is still loading - emit LoadDirectory(ID, dir); -} - -void DirWidget::on_actionUp_triggered(){ - QString dir = CDIR.section("/",0,-2); - if(dir.isEmpty()) - dir = "/"; - //Quick check to ensure the directory exists - while(!QFile::exists(dir) && !dir.isEmpty()){ - dir = dir.section("/",0,-2); //back up one additional dir - } - stopload = true; //just in case it is still loading - emit LoadDirectory(ID, dir); -} - -void DirWidget::on_actionHome_triggered(){ - stopload = true; //just in case it is still loading - emit LoadDirectory(ID, QDir::homePath()); -} - -void DirWidget::on_actionStopLoad_triggered(){ - stopload = true; - ui->actionStopLoad->setVisible(false); -} - -void DirWidget::dir_changed(){ - QString dir = line_dir->text().simplified(); - //Run the dir through the user-input checks - dir = LUtils::PathToAbsolute(dir); - qDebug() << "Dir:" << dir; - //Quick check to ensure the directory exists - while(!QFile::exists(dir) && !dir.isEmpty()){ - dir = dir.section("/",0,-2); //back up one additional dir - } - qDebug() << " - Now Dir:" << dir; - stopload = true; //just in case it is still loading - emit LoadDirectory(ID, dir); -} - -void DirWidget::on_actionClose_Browser_triggered(){ - emit CloseBrowser(ID); -} - -// - Other Actions without a specific button on the side -void DirWidget::fileCheckSums(){ - QStringList files = currentSelection(); - if(files.isEmpty()){ return; } - qDebug() << "Run Checksums:" << files; - QStringList info = LOS::Checksums(files); - qDebug() << " - Info:" << info; - if(info.isEmpty() || (info.length() != files.length()) ){ return; } - for(int i=0; iclear(); - if(!sel.isEmpty()){ - contextMenu->addAction(LXDG::findIcon("run-build-file",""), tr("Open"), this, SLOT(on_tool_act_run_clicked()) ); - contextMenu->addAction(LXDG::findIcon("run-build-configure",""), tr("Open With..."), this, SLOT(on_tool_act_runwith_clicked()) ); - - contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename..."), this, SLOT(on_tool_act_rename_clicked()) )->setEnabled(canmodify); - contextMenu->addAction(LXDG::findIcon("document-encrypted",""), tr("View Checksums..."), this, SLOT(fileCheckSums()) ); - contextMenu->addSeparator(); - } - //Now add the general selection options - contextMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(on_tool_act_cut_clicked()) )->setEnabled(canmodify && !sel.isEmpty()); - contextMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(on_tool_act_copy_clicked()) )->setEnabled(!sel.isEmpty()); - contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(on_tool_act_paste_clicked()) )->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && canmodify); - contextMenu->addSeparator(); - contextMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(on_tool_act_rm_clicked()) )->setEnabled(canmodify&&!sel.isEmpty()); - if(LUtils::isValidBinary("lumina-fileinfo")){ - contextMenu->addSeparator(); - contextMenu->addAction(LXDG::findIcon("edit-find-replace",""), tr("File Properties..."), this, SLOT(fileProperties()) )->setEnabled(!sel.isEmpty()); - } - contextMenu->addSeparator(); - contextMenu->addAction(LXDG::findIcon("system-search",""), tr("Open Terminal here"), this, SLOT(openTerminal())); - - //Now open the menu at the current cursor location - contextMenu->popup(QCursor::pos()); -} - -void DirWidget::SelectionChanged(){ - //Go through and enable/disable the buttons as necessary - bool hasselection = !currentSelection().isEmpty(); - ui->tool_act_copy->setEnabled(hasselection); - ui->tool_act_cut->setEnabled(hasselection && canmodify); - ui->tool_act_fav->setEnabled(hasselection); - ui->tool_act_paste->setEnabled(canmodify && QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") ); - ui->tool_act_rename->setEnabled(hasselection && canmodify); - ui->tool_act_rm->setEnabled(hasselection && canmodify); - ui->tool_act_run->setEnabled(hasselection); - ui->tool_act_runwith->setEnabled(hasselection); -} - -void DirWidget::startSync(const QString &file){ - //Update date_format based on user settings - if(file == sessionsettings_config_file){ setDateFormat(); } - else if(file == snapbasedir){ emit findSnaps(ID, normalbasedir); } //snapshot list changed - else if(file == normalbasedir){ - if(synctimer->isActive()){ synctimer->stop(); } //already starting a sync - restart the timer - synctimer->start(); - }else{ - //Some file in the directory got changed - start the time for a dir reload - // -- This prevents a directory from refreshing constantly if a file within the directory is changing all the time (such as a log file) - if(!synctimer->isActive()){ synctimer->start(); } - } -} - -//==================== -// PROTECTED -//==================== -void DirWidget::mouseReleaseEvent(QMouseEvent *ev){ - static Qt::MouseButtons backmap = Qt::BackButton | Qt::ExtraButton5; - //qDebug() << "Mouse Click:" << ev->button(); - if(backmap.testFlag(ev->button())){ - ev->accept(); - on_actionBack_triggered(); - //}else if(ev->button()==Qt::ForwardButton()){ - //ev->accept(); - }else{ - ev->ignore(); //not handled here - } -} diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.h deleted file mode 100644 index fecd6180..00000000 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.h +++ /dev/null @@ -1,184 +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 -//=========================================== -#ifndef _LUMINA_FM_DIRECTORY_BROWSER_WIDGET_H -#define _LUMINA_FM_DIRECTORY_BROWSER_WIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../DirData.h" -#include "DDListWidgets.h" - -#define ZSNAPDIR QString("/.zfs/snapshot/") - -namespace Ui{ - class DirWidget; -}; - -class DirWidget : public QWidget{ - Q_OBJECT -public: - enum DETAILTYPES{ NAME, SIZE, TYPE, DATEMOD, DATECREATE}; - DirWidget(QString objID, QWidget *parent = 0); //needs a unique ID (to distinguish from other DirWidgets) - ~DirWidget(); - - void cleanup(); //called before the browser is closed down - - //Directory Managment - void ChangeDir(QString dirpath); - void setDirCompleter(QCompleter *comp); - - //Information - QString id(); - QString currentDir(); - - //View Settings - void setShowDetails(bool show); - void setShowSidebar(bool show); - void setShowThumbnails(bool show); - void setDetails(QList list); //Which details to show and in which order (L->R) - void setThumbnailSize(int px); - void setShowCloseButton(bool show); - void setFocusLineDir(); - - //Date format for show items - QStringList getDateFormat(); - void setDateFormat(); - -public slots: - void LoadDir(QString dir, LFileInfoList list); - void LoadSnaps(QString basedir, QStringList snaps); - - //Refresh options - void refresh(); //Refresh current directory - void refreshButtons(); //Refresh action buttons only - - //Theme change functions - void UpdateIcons(); - void UpdateText(); - - //Button updates - void UpdateButtons(); - - //Keyboard Shortcuts triggered - void TryRenameSelection(); - void TryCutSelection(); - void TryCopySelection(); - void TryPasteSelection(); - void TryDeleteSelection(); - -private: - Ui::DirWidget *ui; - QString ID, CDIR; //unique ID assigned by the parent and the current dir path - LFileInfoList CLIST; //current item list (snap or not) - QString normalbasedir, snapbasedir, snaprelpath; //for maintaining directory context while moving between snapshots - QStringList snapshots, needThumbs, tmpSel; - bool showDetails, showThumbs, canmodify, stopload; //which widget to use for showing items - QList listDetails; - QMenu *contextMenu; - QFuture thumbThread; - //The Toolbar and associated items - QToolBar *toolbar; - QLineEdit *line_dir; - QStringList history; - //The drag and drop brower widgets - DDListWidget *listWidget; - DDTreeWidget *treeWidget; - - //Keyboard Shortcuts - //QShortcut *copyFilesShort, *cutFilesShort, *pasteFilesShort, *deleteFilesShort; - //Watcher to determine when the dir changes - QFileSystemWatcher *watcher; - QTimer *synctimer; - - //Functions for internal use - void setupConnections(); - QStringList currentSelection(); - QStringList date_format; - -private slots: - //Internal loading of thumbnails - void startLoadThumbs(); - void showThumb(QString file, QIcon ico); - - //UI BUTTONS/Actions - // -- Left Action Buttons - void on_tool_act_copy_clicked(); - void on_tool_act_cut_clicked(); - void on_tool_act_fav_clicked(); - void on_tool_act_paste_clicked(); - void on_tool_act_rename_clicked(); - void on_tool_act_rm_clicked(); - void on_tool_act_run_clicked(); - void on_tool_act_runwith_clicked(); - // -- Bottom Action Buttons - void on_tool_goToImages_clicked(); - void on_tool_goToPlayer_clicked(); - void on_tool_new_file_clicked(); - void on_tool_new_dir_clicked(); - // -- Top Snapshot Buttons - void on_tool_snap_newer_clicked(); - void on_tool_snap_older_clicked(); - void on_slider_snap_valueChanged(int val = -1); - void direct_snap_selected(QAction*); - - //Top Toolbar buttons - void on_actionBack_triggered(); - void on_actionUp_triggered(); - void on_actionHome_triggered(); - void on_actionStopLoad_triggered(); - void dir_changed(); //user manually changed the directory - void on_actionClose_Browser_triggered(); - - // - Other Actions without a specific button on the side - void fileCheckSums(); - void fileProperties(); - void openTerminal(); - - - //Browser Functions - void OpenContextMenu(); - void SelectionChanged(); - void startSync(const QString &file); //used internally to collect/pause before updating the dir - -signals: - //Directory loading/finding signals - void OpenDirectories(QStringList); //Directories to open in other tabs/columns - void LoadDirectory(QString, QString); //ID, dirpath (Directory to load here) - void findSnaps(QString, QString); //ID, dirpath (Request snapshot information for a directory) - void CloseBrowser(QString); //ID (Request that this browser be closed) - - //External App/Widget launching - void PlayFiles(LFileInfoList); //open in multimedia player - void ViewFiles(LFileInfoList); //open in slideshow - void LaunchTerminal(QString); //dirpath - - //System Interactions - void CutFiles(QStringList); //file selection - void CopyFiles(QStringList); //file selection - void PasteFiles(QString, QStringList); //current dir - void FavoriteFiles(QStringList); //file selection - void RenameFiles(QStringList); //file selection - void RemoveFiles(QStringList); //file selection - - //Internal thumbnail loading system (multi-threaded) - void ThumbLoaded(QString, QIcon); - -protected: - void mouseReleaseEvent(QMouseEvent *); - -}; - -#endif diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.ui b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.ui deleted file mode 100644 index c5bf12c3..00000000 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget.ui +++ /dev/null @@ -1,527 +0,0 @@ - - - DirWidget - - - - 0 - 0 - 400 - 350 - - - - - 350 - 0 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 1 - - - 2 - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Create a new file - - - New File - - - Qt::ToolButtonTextBesideIcon - - - - - - - Create a new directory - - - New Dir - - - Qt::ToolButtonTextBesideIcon - - - - - - - Add selected images to slideshow - - - Slideshow - - - - 20 - 20 - - - - Qt::ToolButtonTextBesideIcon - - - - - - - Enqueue selection in multimedia player - - - Play - - - - 20 - 20 - - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - Status - - - false - - - - - - - - - 1 - - - - - - 1 - - - 1 - - - 1 - - - 1 - - - - - - 0 - 0 - - - - padding-right: 5px; - - - - - - QToolButton::InstantPopup - - - Qt::ToolButtonTextOnly - - - - - - - 1 - - - 1 - - - Qt::Horizontal - - - false - - - false - - - QSlider::TicksAbove - - - - - - - ... - - - - - - - ... - - - - - - - - - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Open item - - - Open item - - - - - - - 20 - 20 - - - - Qt::ToolButtonIconOnly - - - true - - - - - - - Open item (select application) - - - Open item (select application) - - - - - - - 20 - 20 - - - - true - - - - - - - Qt::Horizontal - - - - - - - Add item to personal favorites - - - Add item to personal favorites - - - - - - - 20 - 20 - - - - true - - - - - - - Rename item - - - Rename item - - - - - - - 20 - 20 - - - - true - - - - - - - Qt::Horizontal - - - - - - - Cut items - - - Cut items (add to the clipboard) - - - - - - - 20 - 20 - - - - true - - - - - - - Copy items - - - Copy items to the clipboard - - - - - - - 20 - 20 - - - - true - - - - - - - Paste items from clipboard - - - Paste items from clipboard - - - - - - - 20 - 20 - - - - true - - - - - - - Qt::Horizontal - - - - - - - Delete Items - - - Delete Items - - - - - - - 20 - 20 - - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Back - - - Back - - - Go back to previous directory - - - Go back to previous directory - - - - - Up - - - Up - - - Go to parent directory - - - Go to parent directory - - - - - Home - - - Home - - - Go to home directory - - - Go to home directory - - - - - - - - Stop loading the directory - - - - - Close Browser - - - Close Browser - - - Close this browser - - - Close this browser - - - - - - -- cgit From 6cdd979279875d5f60f8772eeae55bec372ef581 Mon Sep 17 00:00:00 2001 From: JT Pennington Date: Thu, 13 Oct 2016 14:44:12 -0400 Subject: add buttons --- src-qt5/desktop-utils/lumina-calculator/mainUI.ui | 192 +++++++++++++++++++--- 1 file changed, 165 insertions(+), 27 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.ui b/src-qt5/desktop-utils/lumina-calculator/mainUI.ui index 0e52f4db..2ca316ed 100644 --- a/src-qt5/desktop-utils/lumina-calculator/mainUI.ui +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.ui @@ -6,48 +6,186 @@ 0 0 - 245 - 149 + 255 + 376 Calculator - - - - - - + + + + 9 + 9 + 241 + 361 + + + + Qt::Vertical + + + - + - + + + + + + + + C + + + false + + + + + + + + + + + + + 7 + + + + + + + 8 + + + + + + + 9 + + + + + + + / + + + + + + + 4 + + + + + + + 5 + + + + + + + 6 + + + + + + + * + + + + + + + 1 + + + + + + + 2 + + + + + + + 3 + + + + + + + - + + + + + + + 0 + + + + + + + . + + + + + + + = + + + + + - ... + + - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + + + list_results + button_7 + button_8 + button_9 + button_Divide + button_4 + button_5 + button_6 + button_Multiply + button_1 + button_2 + button_3 + button_Subtract + button_0 + button_Decimal + button_Equal + button_Add + line_eq - -- cgit From 850d4681f0da8b2b68f9382b3883a584be5dd712 Mon Sep 17 00:00:00 2001 From: JT Pennington Date: Thu, 13 Oct 2016 14:44:50 -0400 Subject: add buttons --- src-qt5/desktop-utils/lumina-calculator/mainUI.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.h b/src-qt5/desktop-utils/lumina-calculator/mainUI.h index 96414252..0d99c83a 100644 --- a/src-qt5/desktop-utils/lumina-calculator/mainUI.h +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.h @@ -23,10 +23,27 @@ public: private slots: void start_calc(); + void clear_calc(); + void captureButton1(); + void captureButton2(); + void captureButton3(); + void captureButton4(); + void captureButton5(); + void captureButton6(); + void captureButton7(); + void captureButton8(); + void captureButton9(); + void captureButton0(); + void captureButtonSubtract(); + void captureButtonAdd(); + void captureButtonDivide(); + void captureButtonMultiply(); +// void captureButtonEqual(); + void captureButtonDecimal(); + private: Ui::mainUI *ui; - double performOperation(double LHS, double RHS, QChar symbol); double strToNumber(QString str); //this is highly-recursive }; -- cgit From 2db8cc67307a1c33ea982de36a10793efcfff6e1 Mon Sep 17 00:00:00 2001 From: JT Pennington Date: Thu, 13 Oct 2016 14:45:19 -0400 Subject: add buttons --- src-qt5/desktop-utils/lumina-calculator/mainUI.cpp | 43 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp index 18d2cfdd..f759f5c6 100644 --- a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp @@ -16,13 +16,30 @@ mainUI::mainUI() : QMainWindow(), ui(new Ui::mainUI()){ ui->setupUi(this); - connect(ui->tool_start, SIGNAL(clicked()), this, SLOT(start_calc()) ); + connect(ui->tool_clear, SIGNAL(clicked()), this, SLOT(clear_calc()) ); connect(ui->line_eq, SIGNAL(returnPressed()), this, SLOT(start_calc()) ); + connect (ui->button_1, SIGNAL (clicked()), this, SLOT (captureButton1())); + connect (ui->button_2, SIGNAL (clicked()), this, SLOT (captureButton2())); + connect (ui->button_3, SIGNAL (clicked()), this, SLOT (captureButton3())); + connect (ui->button_4, SIGNAL (clicked()), this, SLOT (captureButton4())); + connect (ui->button_5, SIGNAL (clicked()), this, SLOT (captureButton5())); + connect (ui->button_6, SIGNAL (clicked()), this, SLOT (captureButton6())); + connect (ui->button_7, SIGNAL (clicked()), this, SLOT (captureButton7())); + connect (ui->button_8, SIGNAL (clicked()), this, SLOT (captureButton8())); + connect (ui->button_9, SIGNAL (clicked()), this, SLOT (captureButton9())); + connect (ui->button_0, SIGNAL (clicked()), this, SLOT (captureButton0())); + connect (ui->button_Subtract, SIGNAL (clicked()), this, SLOT (captureButtonSubtract())); + connect (ui->button_Add, SIGNAL (clicked()), this, SLOT (captureButtonAdd())); + connect (ui->button_Divide, SIGNAL (clicked()), this, SLOT (captureButtonDivide())); + connect (ui->button_Multiply, SIGNAL (clicked()), this, SLOT (captureButtonMultiply())); + connect (ui->button_Decimal, SIGNAL (clicked()), this, SLOT (captureButtonDecimal())); + connect (ui->button_Equal, SIGNAL (clicked()), this, SLOT (start_calc())); + + ui->line_eq->setFocus(); } mainUI::~mainUI(){ - } void mainUI::start_calc(){ @@ -35,6 +52,28 @@ void mainUI::start_calc(){ ui->line_eq->clear(); } +void mainUI::clear_calc(){ + ui->line_eq->clear(); + ui->line_eq->setFocus(); +} + +void mainUI::captureButton1(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_1->text()); } +void mainUI::captureButton2(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_2->text()); } +void mainUI::captureButton3(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_3->text()); } +void mainUI::captureButton4(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_4->text()); } +void mainUI::captureButton5(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_5->text()); } +void mainUI::captureButton6(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_6->text()); } +void mainUI::captureButton7(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_7->text()); } +void mainUI::captureButton8(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_8->text()); } +void mainUI::captureButton9(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_9->text()); } +void mainUI::captureButton0(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_0->text()); } +void mainUI::captureButtonSubtract(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Subtract->text()); } +void mainUI::captureButtonAdd(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Add->text()); } +void mainUI::captureButtonDivide(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Divide->text()); } +void mainUI::captureButtonMultiply(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Multiply->text()); } +//void mainUI::captureButtonEqual(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Equal->text()); } +void mainUI::captureButtonDecimal(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Decimal->text()); } + double mainUI::performOperation(double LHS, double RHS, QChar symbol){ if(symbol== '+'){ return (LHS+RHS); } else if(symbol== '-'){ return (LHS-RHS); } -- cgit From 12417274b55f86acaa88cceb89b731b3a1398b36 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 13 Oct 2016 16:54:17 -0400 Subject: Add a title/icon for the lumina-calculator window. --- src-qt5/desktop-utils/lumina-calculator/mainUI.cpp | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp index f759f5c6..244a7f3e 100644 --- a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp @@ -8,6 +8,7 @@ #include "ui_mainUI.h" #include +#include #define VALIDSYMBOLS QString("+-*x/.") @@ -18,24 +19,25 @@ mainUI::mainUI() : QMainWindow(), ui(new Ui::mainUI()){ ui->setupUi(this); connect(ui->tool_clear, SIGNAL(clicked()), this, SLOT(clear_calc()) ); connect(ui->line_eq, SIGNAL(returnPressed()), this, SLOT(start_calc()) ); - connect (ui->button_1, SIGNAL (clicked()), this, SLOT (captureButton1())); - connect (ui->button_2, SIGNAL (clicked()), this, SLOT (captureButton2())); - connect (ui->button_3, SIGNAL (clicked()), this, SLOT (captureButton3())); - connect (ui->button_4, SIGNAL (clicked()), this, SLOT (captureButton4())); - connect (ui->button_5, SIGNAL (clicked()), this, SLOT (captureButton5())); - connect (ui->button_6, SIGNAL (clicked()), this, SLOT (captureButton6())); - connect (ui->button_7, SIGNAL (clicked()), this, SLOT (captureButton7())); - connect (ui->button_8, SIGNAL (clicked()), this, SLOT (captureButton8())); - connect (ui->button_9, SIGNAL (clicked()), this, SLOT (captureButton9())); - connect (ui->button_0, SIGNAL (clicked()), this, SLOT (captureButton0())); - connect (ui->button_Subtract, SIGNAL (clicked()), this, SLOT (captureButtonSubtract())); - connect (ui->button_Add, SIGNAL (clicked()), this, SLOT (captureButtonAdd())); - connect (ui->button_Divide, SIGNAL (clicked()), this, SLOT (captureButtonDivide())); - connect (ui->button_Multiply, SIGNAL (clicked()), this, SLOT (captureButtonMultiply())); - connect (ui->button_Decimal, SIGNAL (clicked()), this, SLOT (captureButtonDecimal())); - connect (ui->button_Equal, SIGNAL (clicked()), this, SLOT (start_calc())); - + connect(ui->button_1, SIGNAL (clicked()), this, SLOT (captureButton1())); + connect(ui->button_2, SIGNAL (clicked()), this, SLOT (captureButton2())); + connect(ui->button_3, SIGNAL (clicked()), this, SLOT (captureButton3())); + connect(ui->button_4, SIGNAL (clicked()), this, SLOT (captureButton4())); + connect(ui->button_5, SIGNAL (clicked()), this, SLOT (captureButton5())); + connect(ui->button_6, SIGNAL (clicked()), this, SLOT (captureButton6())); + connect(ui->button_7, SIGNAL (clicked()), this, SLOT (captureButton7())); + connect(ui->button_8, SIGNAL (clicked()), this, SLOT (captureButton8())); + connect(ui->button_9, SIGNAL (clicked()), this, SLOT (captureButton9())); + connect(ui->button_0, SIGNAL (clicked()), this, SLOT (captureButton0())); + connect(ui->button_Subtract, SIGNAL (clicked()), this, SLOT (captureButtonSubtract())); + connect(ui->button_Add, SIGNAL (clicked()), this, SLOT (captureButtonAdd())); + connect(ui->button_Divide, SIGNAL (clicked()), this, SLOT (captureButtonDivide())); + connect(ui->button_Multiply, SIGNAL (clicked()), this, SLOT (captureButtonMultiply())); + connect(ui->button_Decimal, SIGNAL (clicked()), this, SLOT (captureButtonDecimal())); + connect(ui->button_Equal, SIGNAL (clicked()), this, SLOT (start_calc())); + this->setWindowTitle(tr("Calculator")); + this->setWindowIcon( LXDG::findIcon("accessories-calculator","") ); ui->line_eq->setFocus(); } @@ -86,7 +88,7 @@ double mainUI::performOperation(double LHS, double RHS, QChar symbol){ double mainUI::strToNumber(QString str){ //Look for perentheses first - qDebug() << "String to Number: " << str; + //qDebug() << "String to Number: " << str; if(str.indexOf("(")>=0){ //qDebug() << "Found Parenthesis"; int start = str.indexOf("("); -- cgit From 2334aa1c880aecd062a6ff2b272608f675092a95 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 14 Oct 2016 08:50:02 -0400 Subject: Oops - forgot to save the fallback CPU temperature reading into the variable. --- src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp index d0e8cb4e..2bffb5a1 100644 --- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp @@ -294,7 +294,7 @@ QStringList LOS::CPUTemperatures(){ //Returns: List containing the temperature o QStringList temps; if(vars.isEmpty()){ temps = LUtils::getCmdOutput("sysctl -i dev.cpu").filter(".temperature:"); //try direct readings first - if(temps.isEmpty()){ LUtils::getCmdOutput("sysctl -i hw.acpi").filter(".temperature:"); } // then try acpi values + if(temps.isEmpty()){ temps = LUtils::getCmdOutput("sysctl -i hw.acpi").filter(".temperature:"); } // then try acpi values }else{ temps = LUtils::getCmdOutput("sysctl "+vars.join(" ")); vars.clear(); } temps.sort(); -- cgit