aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r--src-qt5/core/libLumina/LDesktopUtils.cpp2
-rw-r--r--src-qt5/core/libLumina/LDesktopUtils.pri1
-rw-r--r--src-qt5/core/libLumina/LFileInfo.cpp184
-rw-r--r--src-qt5/core/libLumina/LFileInfo.h62
-rw-r--r--src-qt5/core/libLumina/LVideoLabel.cpp14
-rw-r--r--src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp57
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.cpp14
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.h4
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.pri8
-rw-r--r--src-qt5/core/libLumina/ResizeMenu.cpp18
-rw-r--r--src-qt5/core/libLumina/ResizeMenu.h5
11 files changed, 321 insertions, 48 deletions
diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp
index f1b3de17..69d4ba52 100644
--- a/src-qt5/core/libLumina/LDesktopUtils.cpp
+++ b/src-qt5/core/libLumina/LDesktopUtils.cpp
@@ -16,7 +16,7 @@
static QStringList fav;
QString LDesktopUtils::LuminaDesktopVersion(){
- QString ver = "1.3.3";
+ QString ver = "1.4.0";
#ifdef GIT_VERSION
ver.append( QString(" (Git Revision: %1)").arg(GIT_VERSION) );
#endif
diff --git a/src-qt5/core/libLumina/LDesktopUtils.pri b/src-qt5/core/libLumina/LDesktopUtils.pri
index fcacc586..ebfa89f4 100644
--- a/src-qt5/core/libLumina/LDesktopUtils.pri
+++ b/src-qt5/core/libLumina/LDesktopUtils.pri
@@ -6,3 +6,4 @@ INCLUDEPATH *= ${PWD}
#Now the other dependendies of it
include(LUtils.pri)
include(LuminaThemes.pri)
+include(LuminaXDG.pri)
diff --git a/src-qt5/core/libLumina/LFileInfo.cpp b/src-qt5/core/libLumina/LFileInfo.cpp
new file mode 100644
index 00000000..e7d2b71a
--- /dev/null
+++ b/src-qt5/core/libLumina/LFileInfo.cpp
@@ -0,0 +1,184 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2013-2017, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "LFileInfo.h"
+#include <LUtils.h>
+
+LFileInfo::LFileInfo() : QFileInfo(){
+ desk = 0;
+}
+
+LFileInfo::LFileInfo(QString filepath) : QFileInfo(){ //overloaded contructor
+ desk = 0;
+ this->setFile(filepath);
+ loadExtraInfo();
+}
+
+LFileInfo::LFileInfo(QFileInfo info) : QFileInfo(){ //overloaded contructor
+ desk = 0;
+ this->swap(info); //use the given QFileInfo without re-loading it
+ loadExtraInfo();
+}
+LFileInfo::~LFileInfo(){
+ if(desk!=0){ desk->deleteLater(); }
+}
+
+//Need some extra information not usually available by a QFileInfo
+void LFileInfo::loadExtraInfo(){
+ if(desk!=0){ desk->deleteLater(); }
+ desk = 0;
+ //Now load the extra information
+ if(this->absoluteFilePath().startsWith("/net/") || this->isDir() ){
+ mime = "inode/directory";
+ //Special directory icons
+ QString name = this->fileName().toLower();
+ if(name=="desktop"){ icon = "user-desktop"; }
+ else if(name=="tmp"){ icon = "folder-temp"; }
+ else if(name=="video" || name=="videos"){ icon = "folder-video"; }
+ else if(name=="music" || name=="audio"){ icon = "folder-sound"; }
+ else if(name=="projects" || name=="devel"){ icon = "folder-development"; }
+ else if(name=="notes"){ icon = "folder-txt"; }
+ else if(name=="downloads"){ icon = "folder-downloads"; }
+ else if(name=="documents"){ icon = "folder-documents"; }
+ else if(name=="images" || name=="pictures"){ icon = "folder-image"; }
+ else if(this->absoluteFilePath().startsWith("/net/")){ icon = "folder-remote"; }
+ else if( !this->isReadable() ){ icon = "folder-locked"; }
+ }else if( this->suffix()=="desktop"){
+ mime = "application/x-desktop";
+ icon = "application-x-desktop"; //default value
+ desk = new XDGDesktop(this->absoluteFilePath(), 0);
+ if(desk->type!=XDGDesktop::BAD){
+ //use the specific desktop file info (if possible)
+ if(!desk->icon.isEmpty()){ icon = desk->icon; }
+ }
+ }else{
+ //Generic file, just determine the mimetype
+ mime = LXDG::findAppMimeForFile(this->fileName());
+ }
+}
+
+bool LFileInfo::zfsAvailable(){
+ static unsigned int avail = 2;
+ if(avail == 2){ avail = (LUtils::isValidBinary("zfs") ? 0 : 1); }
+ return (avail == 0);
+}
+
+void LFileInfo::getZfsDataset(){
+ if(zfs_ds.isEmpty()){
+ //First run - need to probe the current directory
+ bool ok = false;
+ //Use the "atime" property for this check - been around since the earliest versions of ZFS and should take no time to probe
+ QString out = LUtils::runCommand(ok, "zfs", QStringList() << "get" << "-H" << "atime" << this->canonicalFilePath() );
+ if(!ok){ zfs_ds = "."; } //just something that is not empty - but is clearly not a valid dataset
+ else{ zfs_ds = out.section("\n",0,0).section("\t",0,0).simplified(); }
+ //qDebug() << "Found Dataset:" << zfs_ds << out << ok;
+ }
+}
+
+bool LFileInfo::goodZfsDataset(){
+ if(!zfsAvailable()){ return false; }
+ getZfsDataset(); //ensure this field is populated
+ if(zfs_ds=="." || zfs_ds.isEmpty()){ return false; }
+ return true;
+}
+
+//Functions for accessing the extra information
+// -- Return the mimetype for the file
+QString LFileInfo::mimetype(){
+ if(mime=="inode/directory"){ return ""; }
+ else{ return mime; }
+}
+
+// -- Return the icon to use for this file
+QString LFileInfo::iconfile(){
+ if(!icon.isEmpty()){
+ return icon;
+ }else if(!mime.isEmpty()){
+ QString tmp = mime;
+ tmp.replace("/","-");
+ return tmp;
+ }else if(this->isExecutable()){
+ return "application-x-executable";
+ }
+ return ""; //Fall back to nothing
+}
+
+// -- Check if this is an XDG desktop file
+bool LFileInfo::isDesktopFile(){
+ if(desk==0){ return false; }
+ return (!desk->filePath.isEmpty());
+}
+
+// -- Allow access to the XDG desktop data structure
+XDGDesktop* LFileInfo::XDG(){
+ return desk;
+}
+
+// -- Check if this is a readable video file (for thumbnail support)
+bool LFileInfo::isVideo(){
+ if(!mime.startsWith("video/")){ return false; }
+ //Check the hardcoded list of known supported video formats to see if the thumbnail can be generated
+ return ( !LUtils::videoExtensions().filter(this->suffix().toLower()).isEmpty() );
+}
+
+// -- Check if this is a readable image file
+bool LFileInfo::isImage(){
+ if(!mime.startsWith("image/")){ return false; } //quick return for non-image files
+ //Check the Qt subsystems to see if this image file can be read
+ return ( !LUtils::imageExtensions().filter(this->suffix().toLower()).isEmpty() );
+}
+
+bool LFileInfo::isAVFile(){
+ return (mime.startsWith("audio/") || mime.startsWith("video/") );
+}
+
+bool LFileInfo::isZfsDataset(){
+ if(!goodZfsDataset()){ return false; }
+ return ( ("/"+zfs_ds.section("/",1,-1)) == this->canonicalFilePath());
+}
+
+QString LFileInfo::zfsPool(){
+ if(!goodZfsDataset()){ return ""; }
+ return zfs_ds.section("/",0,0);
+}
+
+QStringList LFileInfo::zfsSnapshots(){
+ if(!goodZfsDataset()){ return QStringList(); }
+ QString relpath = this->canonicalFilePath().remove(0, QString("/"+zfs_ds.section("/",1,-1)).length() );
+ //qDebug() << "Got Relative path:" << zfs_ds << this->canonicalFilePath() << relpath;
+ QDir dir("/"+zfs_ds.section("/",1,-1)+"/.zfs/snapshot/");
+ QStringList snaps = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time);
+ for(int i=0; i<snaps.length(); i++){
+ if( QFile::exists(dir.absoluteFilePath(snaps[i])+relpath) ){ snaps[i].append("::::" + dir.absoluteFilePath(snaps[i])+relpath ); }
+ else{ snaps.removeAt(i); i--; }
+ }
+ return snaps;
+}
+
+QJsonObject LFileInfo::zfsProperties(){
+ QJsonObject props;
+ if(!goodZfsDataset()){ return props; }
+ bool ok = false;
+ QStringList out = LUtils::runCommand(ok, "zfs", QStringList() << "get" << "-H" << "all" << zfs_ds).split("\n");
+ //Note: Formating of zfs output: tab-delimited, with columns [dataset, property, value, source]
+ for(int i=0; i<out.length() && ok; i++){
+ if(out[i].simplified().isEmpty()){ continue; }
+ QJsonObject prop;
+ prop.insert("property", out[i].section("\t",1,1).simplified());
+ prop.insert("value", out[i].section("\t",2,2).simplified());
+ prop.insert("source", out[i].section("\t",3,-1).simplified());
+ props.insert(prop.value("property").toString(), prop);
+ }
+ return props;
+}
+
+bool LFileInfo::zfsSetProperty(QString property, QString value){
+ if(!goodZfsDataset()){ return false; }
+ bool ok = false;
+ QString info = LUtils::runCommand(ok, "zfs", QStringList() << "set" << property+"="+value << zfs_ds);
+ if(!ok){ qDebug() << "Error Setting ZFS Property:" << property+"="+value << info; }
+ return ok;
+}
diff --git a/src-qt5/core/libLumina/LFileInfo.h b/src-qt5/core/libLumina/LFileInfo.h
new file mode 100644
index 00000000..df1abb65
--- /dev/null
+++ b/src-qt5/core/libLumina/LFileInfo.h
@@ -0,0 +1,62 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2013-2017, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// File Information simplification class (combine QFileInfo with XDGDesktop)
+// Need some extra information not usually available by a QFileInfo
+// ========================
+#ifndef _LUMINA_LIBRARY_FILE_INFO_H
+#define _LUMINA_LIBRARY_FILE_INFO_H
+
+#include <LuminaXDG.h>
+#include <QString>
+#include <QFileInfo>
+#include <QJsonObject>
+
+class LFileInfo : public QFileInfo{
+private:
+ QString mime, icon, zfs_ds;
+ XDGDesktop *desk;
+
+ void loadExtraInfo();
+ bool zfsAvailable();
+ void getZfsDataset(); //note: only run this if "zfsAvailable" is true
+ bool goodZfsDataset(); //simplification of the two functions above
+
+public:
+ //Couple overloaded contructors
+ LFileInfo();
+ LFileInfo(QString filepath);
+ LFileInfo(QFileInfo info);
+ ~LFileInfo();
+
+ //Functions for accessing the extra information
+ // -- Return the mimetype for the file
+ QString mimetype();
+
+ // -- Return the icon file to use for this file
+ QString iconfile(); //Note: This string is auto-formatted for use in the LXDG::findIcon() routine.
+
+ // -- Check if this is an XDG desktop file
+ bool isDesktopFile();
+
+ // -- Allow access to the internal XDG desktop data structure
+ XDGDesktop* XDG();
+
+ //Other file type identification routines
+ bool isImage(); //Is a readable image file (for thumbnail support)
+ bool isVideo(); //Is a readable video file (for thumbnail support)
+ bool isAVFile(); //Is an audio/video file
+
+ bool isZfsDataset();
+ QString zfsPool();
+ QStringList zfsSnapshots(); //Format: "snapshot name::::path/to/snapshot"
+ QJsonObject zfsProperties();
+ bool zfsSetProperty(QString property, QString value);
+
+};
+typedef QList<LFileInfo> LFileInfoList;
+
+#endif
diff --git a/src-qt5/core/libLumina/LVideoLabel.cpp b/src-qt5/core/libLumina/LVideoLabel.cpp
index bddb1cba..93e95afd 100644
--- a/src-qt5/core/libLumina/LVideoLabel.cpp
+++ b/src-qt5/core/libLumina/LVideoLabel.cpp
@@ -1,15 +1,15 @@
#include "LVideoLabel.h"
#include <LuminaXDG.h>
#include <QCoreApplication>
+#include <QTimer>
LVideoLabel::LVideoLabel(QString file, bool icons, QWidget *parent) : QLabel(parent) {
thumbnail = QPixmap();
entered = false;
this->icons = icons;
filepath = file;
- defaultThumbnail = LXDG::findIcon("unknown", "").pixmap(256,256);
-
- QTimer::singleShot(0, this, SLOT(initializeBackend()) );
+ defaultThumbnail = LXDG::findIcon("media-playback-start", "").pixmap(256,256);
+ QTimer::singleShot(qrand()%10, this, SLOT(initializeBackend()) );
}
LVideoLabel::~LVideoLabel() {
@@ -23,15 +23,17 @@ void LVideoLabel::initializeBackend(){
mediaPlayer->setVideoOutput(surface);
mediaPlayer->setPlaybackRate(3);
mediaPlayer->setMuted(true);
-
+
this->setPixmap(defaultThumbnail.scaled(this->size(),Qt::IgnoreAspectRatio));
mediaPlayer->setMedia(QUrl::fromLocalFile(filepath));
- mediaPlayer->play();
this->connect(surface, SIGNAL(frameReceived(QPixmap)), this, SLOT(stopVideo(QPixmap)));
this->connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(stateChanged(QMediaPlayer::State)));
this->connect(mediaPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(setDuration(QMediaPlayer::MediaStatus)));
this->connect(this, SIGNAL(rollOver()), surface, SLOT(switchRollOver()));
+
+ //QTimer::singleShot( qrand()%100,mediaPlayer, SLOT(play()) );
+ //mediaPlayer->play();
}
void LVideoLabel::enableIcons() {
@@ -72,7 +74,7 @@ void LVideoLabel::setDuration(QMediaPlayer::MediaStatus status) {
mediaPlayer->play();
}else if(status == QMediaPlayer::InvalidMedia){
mediaPlayer->stop();
- mediaPlayer->play();
+ QTimer::singleShot(qrand()%100, mediaPlayer, SLOT(play())); //mediaPlayer->play();
}/*else if(status == QMediaPlayer::LoadingMedia) {
mediaPlayer->pause();
QTimer timer;
diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
index 29a58ec9..dc7de37f 100644
--- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
+++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
@@ -85,7 +85,7 @@ QStringList LOS::ExternalDevicePaths(){
int LOS::ScreenBrightness(){
//First run a quick check to ensure this is not a VirtualBox VM (no brightness control)
static int goodsys = -1; //This will not change over time - only check/set once
- if(goodsys<0){
+ if(goodsys<0){
//Make sure we are not running in VirtualBox (does not work in a VM)
QStringList info = LUtils::getCmdOutput("pciconf -lv");
if( info.filter("VirtualBox", Qt::CaseInsensitive).isEmpty() ){ goodsys = 1; }
@@ -103,8 +103,8 @@ int LOS::ScreenBrightness(){
}
}
//If it gets to this point, then we have a valid (but new) installation
- if(screenbrightness<0){ screenbrightness = 100; } //default value for systems
- return screenbrightness;
+ if(screenbrightness<0){ screenbrightness = 100; } //default value for systems
+ return screenbrightness;
}
//Set screen brightness
@@ -117,12 +117,12 @@ void LOS::setScreenBrightness(int percent){
bool success = false;
// - try hardware setting first (TrueOS || or intel_backlight)
bool remoteSession = !QString(getenv("PICO_CLIENT_LOGIN")).isEmpty();
- if( LUtils::isValidBinary("pc-sysconfig") && !remoteSession){
+ /*if( LUtils::isValidBinary("pc-sysconfig") && !remoteSession){
//Use TrueOS tool (direct sysctl control)
QString ret = LUtils::getCmdOutput("pc-sysconfig", QStringList() <<"setscreenbrightness "+QString::number(percent)).join("");
success = ret.toLower().contains("success");
qDebug() << "Set hardware brightness:" << percent << success;
- }
+ }*/
if( !success && LUtils::isValidBinary("intel_backlight") && !remoteSession){
//Use the intel_backlight utility (only for Intel mobo/hardware?)
if(0== LUtils::runCmd("intel_backlight", QStringList() <<QString::number(percent)) ){
@@ -149,10 +149,10 @@ int LOS::audioVolume(){ //Returns: audio volume as a percentage (0-100, with -1
if(out < 0){
//First time session check: Load the last setting for this user
QString info = LUtils::readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentvolume").join("");
- if(!info.isEmpty()){
- out = info.simplified().toInt();
+ if(!info.isEmpty()){
+ out = info.simplified().toInt();
audiovolume = out; //reset this internal flag
- return out;
+ return out;
}
}
bool remoteSession = !QString(getenv("PICO_CLIENT_LOGIN")).isEmpty();
@@ -173,7 +173,7 @@ int LOS::audioVolume(){ //Returns: audio volume as a percentage (0-100, with -1
//Volume changed by other utility: adjust the saved value as well
LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentvolume", QStringList() << QString::number(out), true);
}
- audiovolume = out;
+ audiovolume = out;
}
}
return out;
@@ -222,7 +222,7 @@ void LOS::changeAudioVolume(int percentdiff){
//Run Command
LUtils::runCmd("mixer vol "+QString::number(L)+":"+QString::number(R));
}
- }
+ }
}
//Check if a graphical audio mixer is installed
@@ -248,7 +248,7 @@ bool LOS::systemPerformingUpdates(){
//Return the details of any updates which are waiting to apply on shutdown
QString LOS::systemPendingUpdates(){
- if(QFile::exists("/tmp/.rebootRequired")){ return LUtils::readFile("/tmp/.rebootRequired").join("\n"); }
+ if(QFile::exists("/tmp/.trueos-update-staged")){ return LUtils::readFile("/tmp/.trueos-update-staged").join("\n"); }
else{ return ""; }
}
@@ -260,24 +260,31 @@ void LOS::systemShutdown(bool skipupdates){ //start poweroff sequence
//System Restart
void LOS::systemRestart(bool skipupdates){ //start reboot sequence
- if(skipupdates){QProcess::startDetached("shutdown -ro now"); }
- else{ QProcess::startDetached("shutdown -r now"); }
+ bool activeupdates = (LUtils::getCmdOutput("sysrc -n trueos_active_update").join("").simplified()=="YES");
+ if(skipupdates){
+ QProcess::startDetached("shutdown -ro now");
+ }else{
+ if(activeupdates && LUtils::isValidBinary("pc-updatemanager") && LOS::systemPendingUpdates().isEmpty()){ QProcess::startDetached("pc-updatemanager startupdate"); }
+ else{ QProcess::startDetached("shutdown -r now"); }
+ }
}
//Check for suspend support
bool LOS::systemCanSuspend(){
- //This will only function on TrueOS
- //(permissions issues on standard FreeBSD unless setup a special way)
- bool ok = QFile::exists("/usr/local/bin/pc-sysconfig");
+ QString state = LUtils::getCmdOutput("sysctl -n hw.acpi.suspend_state").join("").simplified();
+ bool ok = LUtils::getCmdOutput("sysctl -n hw.acpi.supported_sleep_state").join("").split(" ",QString::SkipEmptyParts).contains(state);
+ /*bool ok = QFile::exists("/usr/local/bin/pc-sysconfig");
if(ok){
ok = LUtils::getCmdOutput("pc-sysconfig systemcansuspend").join("").toLower().contains("true");
- }
+ }*/
return ok;
}
//Put the system into the suspend state
void LOS::systemSuspend(){
- QProcess::startDetached("pc-sysconfig suspendsystem");
+ QString state = LUtils::getCmdOutput("sysctl -n hw.acpi.suspend_state").join("").simplified();
+ //QProcess::startDetached("pc-sysconfig suspendsystem");
+ QProcess::startDetached("acpiconf", QStringList() << "-s" << state );
}
//Battery Availability
@@ -289,8 +296,8 @@ bool LOS::hasBattery(){
//Battery Charge Level
int LOS::batteryCharge(){ //Returns: percent charge (0-100), anything outside that range is counted as an error
int charge = LUtils::getCmdOutput("apm -l").join("").toInt();
- if(charge > 100){ charge = -1; } //invalid charge
- return charge;
+ if(charge > 100){ charge = -1; } //invalid charge
+ return charge;
}
//Battery Charging State
@@ -328,11 +335,11 @@ 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()){
+ if(vars.isEmpty()){
temps = LUtils::getCmdOutput("sysctl -i dev.cpu").filter(".temperature:"); //try direct readings first
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();
for(int i=0; i<temps.length(); i++){
if(temps[i].contains(".acpi.") || temps[i].contains(".cpu")){
@@ -383,7 +390,7 @@ int LOS::CPUUsagePercent(){ //Returns: Overall percentage of the amount of CPU c
tot += 100.0L - ( (100.0L*result[i].toLong())/sum ); //remember IDLE is the last of the five values per CPU
}
return qRound(tot/cpnum);
-
+
}
int LOS::MemoryUsagePercent(){
@@ -407,14 +414,14 @@ QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for ea
info[i].replace("\t"," ");
if(i==1){ labs = info[i].split(" ", QString::SkipEmptyParts); }//the labels for each column
else{
- QStringList data = info[i].split(" ",QString::SkipEmptyParts); //data[0] is always the device
+ QStringList data = info[i].split(" ",QString::SkipEmptyParts); //data[0] is always the device
//qDebug() << "Data Line:" << data;
if(data.length()>2 && labs.length()>2){
out << fmt.arg(data[0], data[1]+" "+labs[1], data[2]+" "+labs[2]);
}
}
}
-
+
return out;
}
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp
index cf9e0af2..1933ba93 100644
--- a/src-qt5/core/libLumina/LuminaXDG.cpp
+++ b/src-qt5/core/libLumina/LuminaXDG.cpp
@@ -237,8 +237,9 @@ QString XDGDesktop::generateExec(QStringList inputfiles, QString ActionID){
//Does the app need the input files in URL or File syntax?
bool URLsyntax = (exec.contains("%u") || exec.contains("%U"));
//Adjust the input file formats as needed
+ //qDebug() << "Got inputfiles:" << inputfiles << URLsyntax;
for(int i=0; i<inputfiles.length(); i++){
- bool url = inputfiles[i].contains("://") || inputfiles[i].startsWith("www") || QUrl(inputfiles[i]).isValid();
+ bool url = inputfiles[i].startsWith("www") || inputfiles[i].contains("://");
//Run it through the QUrl class to catch/fix any URL syntax issues
if(URLsyntax){
if(inputfiles[i].startsWith("mailto:") ){} //don't touch this syntax - already formatted
@@ -246,11 +247,14 @@ QString XDGDesktop::generateExec(QStringList inputfiles, QString ActionID){
else{ inputfiles[i] = QUrl::fromLocalFile(inputfiles[i]).url(); }
}else{
//if(inputfiles[i].startsWith("mailto:") ){} //don't touch this syntax - already formatted
+ //qDebug() << "Need local format:" << inputfiles[i] << url;
if(url){ inputfiles[i] = QUrl(inputfiles[i]).toLocalFile(); }
- else{ inputfiles[i] = QUrl::fromLocalFile(inputfiles[i]).toLocalFile(); }
+ else{ inputfiles[i] = inputfiles[i]; } //QUrl::fromLocalFile(inputfiles[i]).toLocalFile(); }
}
}
+ inputfiles.removeAll(""); //just in case any empty ones get through
//Now to the exec replacements as needed
+ //qDebug() << "Generate Exec:" << exec << inputfiles;
if(exec.contains("%f")){
if(inputfiles.isEmpty()){ exec.replace("%f",""); }
else{ exec.replace("%f", "\""+inputfiles.first()+"\""); } //Note: can only take one input
@@ -629,7 +633,7 @@ void XDGDesktopList::populateMenu(QMenu *topmenu, bool byCategory){
//==== LFileInfo Functions ====
//Need some extra information not usually available by a QFileInfo
-void LFileInfo::loadExtraInfo(){
+/*void LFileInfo::loadExtraInfo(){
desk = 0;
//Now load the extra information
if( this->suffix().isEmpty() && (this->absoluteFilePath().startsWith("/net/") || this->isDir()) ){
@@ -722,7 +726,7 @@ bool LFileInfo::isImage(){
bool LFileInfo::isAVFile(){
return (mime.startsWith("audio/") || mime.startsWith("video/") );
-}
+}*/
//==== LXDG Functions ====
@@ -849,7 +853,7 @@ QIcon LXDG::findIcon(QString iconName, QString fallback){
QIcon tmp;
if(!iconName.contains("libreoffice")){ //libreoffice is stupid - their svg icons are un-renderable with Qt
tmp = QIcon::fromTheme(iconName);
- if(tmp.isNull()){ tmp = QIcon::fromTheme(fallback); }
+ //if(tmp.isNull()){ tmp = QIcon::fromTheme(fallback); }
}
if(!tmp.isNull()){ return tmp; } //found one in the theme
diff --git a/src-qt5/core/libLumina/LuminaXDG.h b/src-qt5/core/libLumina/LuminaXDG.h
index 0f7e7c48..066f0462 100644
--- a/src-qt5/core/libLumina/LuminaXDG.h
+++ b/src-qt5/core/libLumina/LuminaXDG.h
@@ -128,7 +128,7 @@ signals:
// File Information simplification class (combine QFileInfo with XDGDesktop)
// Need some extra information not usually available by a QFileInfo
// ========================
-class LFileInfo : public QFileInfo{
+/*class LFileInfo : public QFileInfo{
private:
QString mime, icon;
XDGDesktop *desk;
@@ -162,7 +162,7 @@ public:
bool isVideo(); //Is a readable video file (for thumbnail support)
bool isAVFile(); //Is an audio/video file
};
-typedef QList<LFileInfo> LFileInfoList;
+typedef QList<LFileInfo> LFileInfoList;*/
// ================================
// Collection of FreeDesktop standards interaction routines
diff --git a/src-qt5/core/libLumina/LuminaXDG.pri b/src-qt5/core/libLumina/LuminaXDG.pri
index 6f3a2b7c..1a8a8368 100644
--- a/src-qt5/core/libLumina/LuminaXDG.pri
+++ b/src-qt5/core/libLumina/LuminaXDG.pri
@@ -1,10 +1,12 @@
QT *= multimedia svg
#LUtils Files
-SOURCES *= $${PWD}/LuminaXDG.cpp
-HEADERS *= $${PWD}/LuminaXDG.h
+SOURCES *= $${PWD}/LuminaXDG.cpp \
+ $${PWD}/LFileInfo.cpp
+HEADERS *= $${PWD}/LuminaXDG.h \
+ $${PWD}/LFileInfo.h
-INCLUDEPATH *= ${PWD}
+INCLUDEPATH *= $${PWD}
#include LUtils and LuminaOS
include(LUtils.pri)
diff --git a/src-qt5/core/libLumina/ResizeMenu.cpp b/src-qt5/core/libLumina/ResizeMenu.cpp
index 9f291134..cf5b124d 100644
--- a/src-qt5/core/libLumina/ResizeMenu.cpp
+++ b/src-qt5/core/libLumina/ResizeMenu.cpp
@@ -5,6 +5,7 @@
// See the LICENSE file for full details
//===========================================
#include "ResizeMenu.h"
+#include <QDebug>
// =======================
// RESIZEMENU CLASS
@@ -21,7 +22,7 @@ ResizeMenu::ResizeMenu(QWidget *parent) : QMenu(parent){
}
ResizeMenu::~ResizeMenu(){
-
+
}
void ResizeMenu::setContents(QWidget *con){
@@ -30,6 +31,15 @@ void ResizeMenu::setContents(QWidget *con){
this->addAction(cAct);
contents = con; //save for later
contents->setCursor(Qt::ArrowCursor);
+ resyncSize();
+}
+
+void ResizeMenu::resyncSize(){
+ if(contents==0){ return; }
+ qDebug() << "Resync Size:" << this->size() << contents->size();
+ this->resize(contents->size());
+ qDebug() << " - after menu resize:" << this->size() << contents->size();
+ emit MenuResized(this->size());
}
void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){
@@ -46,21 +56,21 @@ void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){
this->setGeometry(geom);
if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));}
handled = true;
- break;
+ break;
case BOTTOM:
if(gpos.y() <= geom.top()+1){ break; }
geom.setBottom( gpos.y());
this->setGeometry(geom);
if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));}
handled = true;
- break;
+ break;
case LEFT:
if(gpos.x() >= geom.right()-1){ break; }
geom.setLeft(gpos.x());
this->setGeometry(geom);
if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));}
handled = true;
- break;
+ break;
case RIGHT:
if(gpos.x() <= geom.left()+1){ break; }
geom.setRight(gpos.x());
diff --git a/src-qt5/core/libLumina/ResizeMenu.h b/src-qt5/core/libLumina/ResizeMenu.h
index ed909da3..029d2716 100644
--- a/src-qt5/core/libLumina/ResizeMenu.h
+++ b/src-qt5/core/libLumina/ResizeMenu.h
@@ -17,7 +17,7 @@
#include <QPoint>
//Special subclass for a menu which the user can grab the edges and resize as necessary
-// Note: Make sure that you don't set 0pixel contents margins on this menu
+// Note: Make sure that you don't set 0pixel contents margins on this menu
// - it needs at least 1 pixel margins for the user to be able to grab it
class ResizeMenu : public QMenu{
Q_OBJECT
@@ -26,13 +26,14 @@ public:
virtual ~ResizeMenu();
void setContents(QWidget *con);
+ void resyncSize();
private:
enum SideFlag{NONE, TOP, BOTTOM, LEFT, RIGHT};
SideFlag resizeSide;
QWidget *contents;
QWidgetAction *cAct;
-
+
private slots:
void clearFlags(){
resizeSide=NONE;
bgstack15