aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fileinfo
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fileinfo')
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp460
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/MainUI.h42
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui1048
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro3
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/main.cpp32
5 files changed, 978 insertions, 607 deletions
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
index d82f09ce..e64346ae 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
@@ -8,21 +8,25 @@
#include "MainUI.h"
#include "ui_MainUI.h"
+#include <QVideoFrame>
#include <QFileDialog>
#include <QMessageBox>
#include <LUtils.h>
#include <LuminaOS.h>
-//LFileInfo INFO = LFileInfo("");
-
-MainUI::MainUI() : QDialog(), ui(new Ui::MainUI){
+MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
ui->setupUi(this); //load the designer form
canwrite = false;
terminate_thread = false;
+ INFO = new LFileInfo();
UpdateIcons(); //Set all the icons in the dialog
SetupConnections();
- INFO = 0;
+
+ //Disable buttons that are not working yet
+ //ui->actionOpen_File->setVisible(false);
+ //ui->actionOpen_Directory->setVisible(false);
+ //ui->menuSave_As->setEnabled(false);
}
MainUI::~MainUI(){
@@ -38,133 +42,38 @@ void MainUI::LoadFile(QString path, QString type){
//Do the first file information tab
qDebug() << "Load File:" << path << type;
INFO = new LFileInfo(path);
- if(INFO->exists()){ canwrite = INFO->isWritable(); }
- else if(!INFO->filePath().isEmpty()){
- //See if the containing directory can be written
- //QFileInfo chk(INFO->absolutePath());
- canwrite = (INFO->isDir() && INFO->isWritable());
- }else{
- canwrite = true; //no associated file yet
- }
- if(!INFO->exists() && !type.isEmpty()){
- //Set the proper type flag on the shortcut
- if(type=="APP"){ INFO->XDG()->type = XDGDesktop::APP; }
- else if(type=="LINK"){ INFO->XDG()->type = XDGDesktop::LINK; }
- }
//First load the general file information
if(!INFO->filePath().isEmpty()){
- ui->label_file_name->setText( INFO->fileName() );
- ui->label_file_mimetype->setText( INFO->mimetype() );
- if(!INFO->isDir()){ ui->label_file_size->setText( LUtils::BytesToDisplaySize( INFO->size() ) ); }
- else {
- ui->label_file_size->setText(tr("---Calculating---"));
- QtConcurrent::run(this, &MainUI::GetDirSize, INFO->absoluteFilePath());
- }
- ui->label_file_owner->setText(INFO->owner());
- ui->label_file_group->setText(INFO->group());
- ui->label_file_created->setText( INFO->created().toString(Qt::SystemLocaleLongDate) );
- ui->label_file_modified->setText( INFO->lastModified().toString(Qt::SystemLocaleLongDate) );
- //Get the file permissions
- QString perms;
- if(INFO->isReadable() && INFO->isWritable()){ perms = tr("Read/Write"); }
- else if(INFO->isReadable()){ perms = tr("Read Only"); }
- else if(INFO->isWritable()){ perms = tr("Write Only"); }
- else{ perms = tr("No Access"); }
- ui->label_file_perms->setText(perms);
- //Now the special "type" for the file
- QString ftype;
- if(INFO->suffix().toLower()=="desktop"){ ftype = tr("XDG Shortcut"); }
- else if(INFO->isDir()){ ftype = tr("Directory"); }
- else if(INFO->isExecutable()){ ftype = tr("Binary"); }
- else{ ftype = INFO->suffix().toUpper(); }
- if(INFO->isHidden()){ ftype = QString(tr("Hidden %1")).arg(type); }
- ui->label_file_type->setText(ftype);
- //Now load the icon for the file
- if(INFO->isImage()){
- //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";
+ SyncFileInfo();
}else{
- if(ui->tabWidget->indexOf(ui->tab_file)>=0){
- ui->tabWidget->removeTab( ui->tabWidget->indexOf(ui->tab_file) );
- }
+ SetupNewFile();
}
- //Now load the special XDG desktop info
- qDebug() << "Check XDG Info:" << type;
- //qDebug() << INFO->isDesktopFile() << type;
- if(INFO->isDesktopFile() || !type.isEmpty()){
-
- if(INFO->XDG()->type == XDGDesktop::APP){
- ui->line_xdg_command->setText(INFO->XDG()->exec);
- ui->line_xdg_wdir->setText(INFO->XDG()->path);
- ui->check_xdg_useTerminal->setChecked( INFO->XDG()->useTerminal );
- ui->check_xdg_startupNotify->setChecked( INFO->XDG()->startupNotify );
- }else if(INFO->XDG()->type==XDGDesktop::LINK){
- //Hide the options that are unavailable for links
- //Command line (exec)
- ui->line_xdg_command->setVisible(false);
- ui->tool_xdg_getCommand->setVisible(false);
- ui->lblCommand->setVisible(false);
- //Options
- ui->lblOptions->setVisible(false);
- ui->check_xdg_useTerminal->setVisible(false);
- ui->check_xdg_startupNotify->setVisible(false);
- //Now load the variables for this type of shortcut
- ui->lblWorkingDir->setText(tr("URL:"));
- ui->line_xdg_wdir->setText( INFO->XDG()->url );
- ui->tool_xdg_getDir->setVisible(false); //the dir selection button
-
- }
- ui->line_xdg_name->setText(INFO->XDG()->name);
- ui->line_xdg_comment->setText(INFO->XDG()->comment);
- ui->push_xdg_getIcon->setWhatsThis( INFO->XDG()->icon );
- ReloadAppIcon();
- ui->push_save->setVisible(true);
- ui->push_save->setEnabled(false);
- //Now ensure the xdg tab exists in the widget
- if(ui->tabWidget->indexOf(ui->tab_deskedit)<0){
- qDebug() << "Adding the deskedit tab";
- ui->tabWidget->addTab(ui->tab_deskedit, tr("Edit Shortcut"));
- }
- }else{
- xdgvaluechanged(); //just do the disables here
- //Also remove the xdg tab
- if(ui->tabWidget->indexOf(ui->tab_deskedit) >= 0){
- qDebug() << "Removing the deskedit tab";
- ui->tabWidget->removeTab( ui->tabWidget->indexOf(ui->tab_deskedit) );
- }
- }
- //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(){
- this->setWindowIcon(LXDG::findIcon("document-preview","unknown"));
- ui->push_close->setIcon( LXDG::findIcon("dialog-close","") );
- ui->push_save->setIcon( LXDG::findIcon("document-save","") );
- ui->tool_xdg_getCommand->setIcon( LXDG::findIcon("edit-find-page","") );
- ui->tool_xdg_getDir->setIcon( LXDG::findIcon("document-open","") );
+
}
//==============
// PRIVATE
//==============
void MainUI::ReloadAppIcon(){
- ui->push_xdg_getIcon->setIcon( LXDG::findIcon(ui->push_xdg_getIcon->whatsThis(),"") );
+ //qDebug() << "Reload App Icon:";
+ ui->label_xdg_icon->setPixmap( LXDG::findIcon(ui->line_xdg_icon->text(),"").pixmap(64,64) );
+ //qDebug() << "Check Desktop File entry";
+ if(INFO->iconfile()!=ui->line_xdg_icon->text()){
+ xdgvaluechanged();
+ }
+ //qDebug() << "Done with app icon";
+}
+
+void MainUI::stopDirSize(){
+ if(sizeThread.isRunning()){
+ terminate_thread = true;
+ sizeThread.waitForFinished();
+ QApplication::processEvents(); //throw away any last signals waiting to be processed
+ }
+ terminate_thread = false;
}
void MainUI::GetDirSize(const QString dirname) const {
@@ -215,10 +124,201 @@ void MainUI::GetDirSize(const QString dirname) const {
emit folder_size_changed(filesize, file_number, dir_number, true);
}
+void MainUI::SyncFileInfo(){
+ qDebug() << "Sync File Info";
+ stopDirSize();
+ if(INFO->filePath().isEmpty()){ return; }
+ if(INFO->exists()){ canwrite = INFO->isWritable(); }
+ else{
+ //See if the containing directory can be written
+ QFileInfo chk(INFO->absolutePath());
+ canwrite = (chk.isDir() && chk.isWritable());
+ }
+ ui->label_file_name->setText( INFO->fileName() );
+ ui->label_file_mimetype->setText( INFO->mimetype() );
+ if(!INFO->isDir()){ ui->label_file_size->setText( LUtils::BytesToDisplaySize( INFO->size() ) ); }
+ else {
+ ui->label_file_size->setText(tr("---Calculating---"));
+ sizeThread = QtConcurrent::run(this, &MainUI::GetDirSize, INFO->absoluteFilePath());
+ }
+ ui->label_file_owner->setText(INFO->owner());
+ ui->label_file_group->setText(INFO->group());
+ ui->label_file_created->setText( INFO->created().toString(Qt::SystemLocaleLongDate) );
+ ui->label_file_modified->setText( INFO->lastModified().toString(Qt::SystemLocaleLongDate) );
+ //Get the file permissions
+ QString perms;
+ if(INFO->isReadable() && INFO->isWritable()){ perms = tr("Read/Write"); }
+ else if(INFO->isReadable()){ perms = tr("Read Only"); }
+ else if(INFO->isWritable()){ perms = tr("Write Only"); }
+ else{ perms = tr("No Access"); }
+ ui->label_file_perms->setText(perms);
+ //Now the special "type" for the file
+ QString ftype;
+ if(INFO->suffix().toLower()=="desktop"){ ftype = tr("XDG Shortcut"); }
+ else if(INFO->isDir()){ ftype = tr("Directory"); }
+ else if(INFO->isExecutable()){ ftype = tr("Binary"); }
+ else{ ftype = INFO->suffix().toUpper(); }
+ if(INFO->isHidden()){ ftype = QString(tr("Hidden %1")).arg(ftype); }
+ ui->label_file_type->setText(ftype);
+
+ //Now load the icon for the file
+ if(INFO->isImage()){
+ 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)" );
+ }else if(INFO->isVideo()){
+ ui->label_file_icon->hide();
+ LVideoLabel *mediaLabel = new LVideoLabel(INFO->absoluteFilePath(), true, ui->tab_file);
+ mediaLabel->setFixedSize(64,64);
+ ui->formLayout->replaceWidget(ui->label_file_icon, mediaLabel);
+ }else{
+ ui->label_file_icon->setPixmap( LXDG::findIcon( INFO->iconfile(), "unknown").pixmap(QSize(64,64)) );
+ }
+
+ //qDebug() << "Check XDG Info:"
+ //qDebug() << INFO->isDesktopFile() << type;
+ syncXdgStruct(INFO->XDG());
+ //Make sure the right tabs are available
+ if(ui->tabWidget->indexOf(ui->tab_file)<0){
+ //qDebug() << "Add File Info Tab";
+ ui->tabWidget->insertTab(0, ui->tab_file, tr("File Information"));
+ }
+ if(!INFO->isDesktopFile()){
+ if(ui->tabWidget->indexOf(ui->tab_deskedit)>=0){
+ ui->tabWidget->removeTab( ui->tabWidget->indexOf(ui->tab_deskedit) );
+ }
+ }else if(ui->tabWidget->indexOf(ui->tab_deskedit)<0){
+ ui->tabWidget->addTab( ui->tab_deskedit, tr("XDG Shortcut") );
+ }
+ ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->tab_file) );
+}
+
+void MainUI::SetupNewFile(){
+ //qDebug() << "Setup New File";
+ if(!INFO->filePath().isEmpty()){
+ INFO = new LFileInfo();
+ }
+ stopDirSize();
+ canwrite = true; //can always write a new file
+ syncXdgStruct(INFO->XDG());
+ //Make sure the right tabs are enabled
+ if(ui->tabWidget->indexOf(ui->tab_file)>=0){
+ ui->tabWidget->removeTab( ui->tabWidget->indexOf(ui->tab_file) );
+ }
+ if(ui->tabWidget->indexOf(ui->tab_deskedit)<0){
+ //qDebug() << "Adding the deskedit tab";
+ ui->tabWidget->addTab(ui->tab_deskedit, tr("XDG Shortcut"));
+ }
+ ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->tab_deskedit) );
+}
+
+void MainUI::syncXdgStruct(XDGDesktop *XDG){
+ bool cleanup = false;
+ if(XDG==0){ XDG = new XDGDesktop(); cleanup = true;} //make sure nothing crashes
+ if(XDG->type == XDGDesktop::APP){
+ ui->line_xdg_command->setText(XDG->exec);
+ ui->line_xdg_wdir->setText(XDG->path);
+ ui->check_xdg_useTerminal->setChecked( XDG->useTerminal );
+ ui->check_xdg_startupNotify->setChecked( XDG->startupNotify );
+ }else if(XDG->type==XDGDesktop::LINK){
+ //Hide the options that are unavailable for links
+ //Command line (exec)
+ ui->line_xdg_command->setVisible(false);
+ ui->tool_xdg_getCommand->setVisible(false);
+ ui->lblCommand->setVisible(false);
+ //Options
+ ui->lblOptions->setVisible(false);
+ ui->check_xdg_useTerminal->setVisible(false);
+ ui->check_xdg_startupNotify->setVisible(false);
+ //Now load the variables for this type of shortcut
+ ui->lblWorkingDir->setText(tr("URL:"));
+ ui->line_xdg_wdir->setText( XDG->url );
+ ui->tool_xdg_getDir->setVisible(false); //the dir selection button
+ }
+ ui->line_xdg_name->setText(XDG->name);
+ ui->line_xdg_comment->setText(XDG->comment);
+ ui->line_xdg_icon->setText( XDG->icon );
+ ReloadAppIcon();
+ ui->actionSave_Shortcut->setVisible(true);
+ ui->actionSave_Shortcut->setEnabled(false);
+ if(cleanup){ delete XDG; }
+ checkXDGValidity();
+}
+
+bool MainUI::saveFile(QString path){
+ //qDebug() << "Request save file:" << path;
+ XDGDesktop *XDG = INFO->XDG();
+ if(XDG==0){ XDG = new XDGDesktop(); }
+ if(XDG->type == XDGDesktop::BAD){ XDG->type = XDGDesktop::APP; }
+ //Update the file path in the data structure
+ XDG->filePath = path;
+ //Now change the structure
+ XDG->name = ui->line_xdg_name->text();
+ XDG->genericName = ui->line_xdg_name->text().toLower();
+ XDG->comment = ui->line_xdg_comment->text();
+ XDG->icon = ui->line_xdg_icon->text();
+ //Now do the type-specific fields
+ if(XDG->type == XDGDesktop::APP){
+ XDG->exec = ui->line_xdg_command->text();
+ XDG->tryexec = ui->line_xdg_command->text().section(" ",0,0); //use the first word/binary for the existance check
+ XDG->path = ui->line_xdg_wdir->text(); //working dir/path
+ XDG->useTerminal = ui->check_xdg_useTerminal->isChecked();
+ XDG->startupNotify = ui->check_xdg_startupNotify->isChecked();
+ }else if(XDG->type==XDGDesktop::LINK){
+ XDG->url = ui->line_xdg_wdir->text(); //we re-used this field
+ }
+ //Clear any info which this utility does not support at the moment
+ XDG->actionList.clear();
+ XDG->actions.clear();
+ //Now save the structure to file
+ //qDebug() << "Saving File:" << XDG->filePath;
+ return XDG->saveDesktopFile(true); //Try to merge the file/structure as necessary
+}
+
+QString MainUI::findOpenDirFile(bool isdir){
+ static QList<QUrl> urls;
+ if(urls.isEmpty()){
+ urls << QUrl::fromLocalFile("/");
+ QStringList dirs = QString(getenv("XDG_DATA_DIRS")).split(":");
+ for(int i=0; i<dirs.length(); i++){
+ if(QFile::exists(dirs[i]+"/applications")){ urls << QUrl::fromLocalFile(dirs[i]+"/applications"); }
+ }
+ //Now do the home-directory folders
+ urls << QUrl::fromLocalFile(QDir::homePath());
+ QString localapps = QString(getenv("XDG_DATA_HOME"))+"/applications";
+ if(QFile::exists(localapps)){ urls << QUrl::fromLocalFile(localapps); }
+ }
+ static QString lastdir = QDir::homePath();
+ QFileDialog dlg(this);
+ dlg.setAcceptMode(QFileDialog::AcceptOpen);
+ dlg.setFileMode( isdir ? QFileDialog::Directory : QFileDialog::ExistingFiles );
+ dlg.setOptions(QFileDialog::ReadOnly | QFileDialog::HideNameFilterDetails);
+ dlg.setViewMode(QFileDialog::Detail);
+ dlg.setSidebarUrls( urls );
+ dlg.setDirectory(lastdir);
+ if(!dlg.exec() ){ return ""; } //cancelled
+ if(dlg.selectedFiles().isEmpty()){ return ""; }
+ QString path = dlg.selectedFiles().first();
+ //Update the last used directory
+ if(isdir){ lastdir = path; } //save this for next time
+ else{ lastdir = path.section("/",0,-2); }
+ //return the path
+ return path;
+}
+
+
// Initialization procedures
void MainUI::SetupConnections(){
+ connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(closeApplication()) );
+ connect(ui->actionSave_Shortcut, SIGNAL(triggered()), this, SLOT(save_clicked()) );
+ connect(ui->actionLocal_Shortcut, SIGNAL(triggered()), this, SLOT(save_as_local_clicked()) );
+ connect(ui->actionRegister_Shortcut, SIGNAL(triggered()), this, SLOT(save_as_register_clicked()) );
+ connect(ui->actionNew_Shortcut, SIGNAL(triggered()), this, SLOT(SetupNewFile()) );
+ connect(ui->actionOpen_File, SIGNAL(triggered()), this, SLOT(open_file_clicked()) );
+ connect(ui->actionOpen_Directory, SIGNAL(triggered()), this, SLOT(open_dir_clicked()) );
connect(ui->line_xdg_command, SIGNAL(editingFinished()), this, SLOT(xdgvaluechanged()) );
connect(ui->line_xdg_comment, SIGNAL(editingFinished()), this, SLOT(xdgvaluechanged()) );
+ connect(ui->line_xdg_icon, SIGNAL(textChanged(QString)), this, SLOT(ReloadAppIcon()) );
connect(ui->tool_xdg_getCommand, SIGNAL(clicked()), this, SLOT(getXdgCommand()) );
connect(ui->line_xdg_name, SIGNAL(editingFinished()), this, SLOT(xdgvaluechanged()) );
connect(ui->line_xdg_wdir, SIGNAL(editingFinished()), this, SLOT(xdgvaluechanged()) );
@@ -228,58 +328,81 @@ void MainUI::SetupConnections(){
}
//UI Buttons
-void MainUI::on_push_close_clicked(){
+void MainUI::closeApplication(){
terminate_thread = true;
- if(ui->push_save->isEnabled()){
+ if(ui->actionSave_Shortcut->isEnabled()){
//Still have unsaved changes
//TO-DO - prompt for whether to save the changes
}
this->close();
}
-void MainUI::on_push_save_clicked(){
+void MainUI::save_clicked(){
//Save all the xdg values into the structure
- if( (!INFO->isDesktopFile() && !INFO->filePath().isEmpty()) || !canwrite){ return; }
- if(INFO->filePath().isEmpty()){
+ QString filePath = INFO->filePath();
+ if( !filePath.isEmpty() && !INFO->isDesktopFile() ){ return; }
+ if(filePath.isEmpty() || !canwrite){
//Need to prompt for where to save the file and what to call it
QString appdir = QString(getenv("XDG_DATA_HOME"))+"/applications/";
if(!QFile::exists(appdir)){ QDir dir; dir.mkpath(appdir); }
- QString filePath = QFileDialog::getSaveFileName(this, tr("Save Application File"), appdir, tr("Application Registrations (*.desktop)") );
+ filePath = QFileDialog::getSaveFileName(this, tr("Save Application File"), appdir, tr("XDG Shortcuts (*.desktop)") );
if(filePath.isEmpty()){ return; }
if(!filePath.endsWith(".desktop")){ filePath.append(".desktop"); }
- //Update the file paths in the data structure
- INFO->setFile(filePath);
- INFO->XDG()->filePath = filePath;
}
- XDGDesktop *XDG = INFO->XDG();
- //Now change the structure
- XDG->name = ui->line_xdg_name->text();
- XDG->genericName = ui->line_xdg_name->text().toLower();
- XDG->comment = ui->line_xdg_comment->text();
- XDG->icon = ui->push_xdg_getIcon->whatsThis();
- //Now do the type-specific fields
- if(XDG->type == XDGDesktop::APP){
- XDG->exec = ui->line_xdg_command->text();
- XDG->tryexec = ui->line_xdg_command->text().section(" ",0,0); //use the first word/binary for the existance check
- XDG->path = ui->line_xdg_wdir->text(); //working dir/path
- XDG->useTerminal = ui->check_xdg_useTerminal->isChecked();
- XDG->startupNotify = ui->check_xdg_startupNotify->isChecked();
- }else if(XDG->type==XDGDesktop::LINK){
- XDG->url = ui->line_xdg_wdir->text(); //we re-used this field
+ //qDebug() << " -Try Saving File:" << filePath;
+ bool saved = saveFile(filePath);
+ //qDebug() << "File Saved:" << saved;
+ ui->actionSave_Shortcut->setEnabled( !saved );
+ if(saved){
+ //Re-load the file info
+ LoadFile(filePath);
}
- //Clear any info which this utility does not support at the moment
- XDG->actionList.clear();
- XDG->actions.clear();
- //Now save the structure to file
- bool saved = XDG->saveDesktopFile(true); //Try to merge the file/structure as necessary
- qDebug() << "File Saved:" << saved;
- ui->push_save->setEnabled( !saved );
+}
+
+void MainUI::save_as_local_clicked(){
+ QString filePath = QFileDialog::getSaveFileName(this, tr("Save Application File"), QDir::homePath(), tr("XDG Shortcuts (*.desktop)") );
+ if(filePath.isEmpty()){ return; }
+ if(!filePath.endsWith(".desktop")){ filePath.append(".desktop"); }
+
+ //qDebug() << " -Try Saving File:" << filePath;
+ bool saved = saveFile(filePath);
+ //qDebug() << "File Saved:" << saved;
+ ui->actionSave_Shortcut->setEnabled( !saved );
if(saved){
//Re-load the file info
- LoadFile(INFO->absoluteFilePath());
+ LoadFile(filePath);
}
}
+void MainUI::save_as_register_clicked(){
+ QString appdir = QString(getenv("XDG_DATA_HOME"))+"/applications/";
+ if(!QFile::exists(appdir)){ QDir dir; dir.mkpath(appdir); }
+ QString filePath = QFileDialog::getSaveFileName(this, tr("Save Application File"), appdir, tr("XDG Shortcuts (*.desktop)") );
+ if(filePath.isEmpty()){ return; }
+ if(!filePath.endsWith(".desktop")){ filePath.append(".desktop"); }
+
+ //qDebug() << " -Try Saving File:" << filePath;
+ bool saved = saveFile(filePath);
+ //qDebug() << "File Saved:" << saved;
+ ui->actionSave_Shortcut->setEnabled( !saved );
+ if(saved){
+ //Re-load the file info
+ LoadFile(filePath);
+ }
+}
+
+void MainUI::open_dir_clicked(){
+ QString path = findOpenDirFile(true); //directory only
+ if(path.isEmpty()){ return; }
+ LoadFile(path, "");
+}
+
+void MainUI::open_file_clicked(){
+ QString path = findOpenDirFile(false); //files only
+ if(path.isEmpty()){ return; }
+ LoadFile(path, "");
+}
+
void MainUI::getXdgCommand(QString prev){
//Find a binary to run
QString dir = prev; //start with the previous attempt (if there was one)
@@ -315,22 +438,45 @@ void MainUI::on_push_xdg_getIcon_clicked(){
for(int i=0; i<ext.length(); i++){ ext[i].prepend("*."); } //turn them into valid filters
QString file = QFileDialog::getOpenFileName(this, tr("Select an icon"), dir ,QString(tr("Images (%1);; All Files (*)")).arg(ext.join(" ")) );
if(file.isEmpty()){ return; } //cancelled
- ui->push_xdg_getIcon->setWhatsThis(file);
+ ui->line_xdg_icon->setText(file);
ReloadAppIcon();
xdgvaluechanged();
}
//XDG Value Changed
+bool MainUI::checkXDGValidity(){
+ XDGDesktop tmp;
+ tmp.type = XDGDesktop::APP; //make this adjustable later (GUI radio buttons?)
+ tmp.name = ui->line_xdg_name->text();
+ tmp.genericName = ui->line_xdg_name->text().toLower();
+ tmp.comment = ui->line_xdg_comment->text();
+ tmp.icon = ui->line_xdg_icon->text();
+ //Now do the type-specific fields
+ if(tmp.type == XDGDesktop::APP){
+ tmp.exec = ui->line_xdg_command->text();
+ tmp.tryexec = ui->line_xdg_command->text().section(" ",0,0); //use the first word/binary for the existance check
+ tmp.path = ui->line_xdg_wdir->text(); //working dir/path
+ tmp.useTerminal = ui->check_xdg_useTerminal->isChecked();
+ tmp.startupNotify = ui->check_xdg_startupNotify->isChecked();
+ }else if(tmp.type==XDGDesktop::LINK){
+ tmp.url = ui->line_xdg_wdir->text(); //we re-used this field
+ }
+ bool valid = tmp.isValid();
+ ui->label_xdg_statusicon->setPixmap( LXDG::findIcon( valid ? "dialog-ok" : "dialog-cancel", "").pixmap(32,32) );
+ ui->label_xdg_status->setText( valid ? tr("Valid Settings") : tr("Invalid Settings") );
+ return tmp.isValid();
+}
+
void MainUI::xdgvaluechanged(){
- if(INFO!=0 && (INFO->isDesktopFile() || INFO->filePath().isEmpty() ) ){
- ui->push_save->setVisible(true);
+ //qDebug() << "xdgvaluechanged";
+ if( INFO->isDesktopFile() || INFO->filePath().isEmpty() ){
+ bool valid = checkXDGValidity();
//Compare the current UI values to the file values
- ui->push_save->setEnabled(canwrite); //assume changed at this point
- // TO-DO
+ ui->menuSave_As->setEnabled(valid);
+ ui->actionSave_Shortcut->setEnabled(canwrite && valid); //assume changed at this point
}else{
- ui->push_save->setVisible(false);
- ui->push_save->setEnabled(false);
+ ui->actionSave_Shortcut->setEnabled(false);
}
}
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
index cbe23d9e..d7b17207 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
+++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.h
@@ -13,15 +13,20 @@
#ifndef _LUMINA_FILE_INFO_MAIN_UI_H
#define _LUMINA_FILE_INFO_MAIN_UI_H
-#include <QDialog>
+#include <QMainWindow>
+#include <QMediaPlayer>
+#include <LVideoSurface.h>
+#include <LVideoLabel.h>
+#include <QElapsedTimer>
+#include <QFuture>
#include <LuminaXDG.h>
namespace Ui{
- class MainUI;
+ class MainUI;
};
-class MainUI : public QDialog{
+class MainUI : public QMainWindow{
Q_OBJECT
public:
MainUI();
@@ -31,36 +36,55 @@ public:
public slots:
void UpdateIcons();
+ void ReloadAppIcon();
private:
Ui::MainUI *ui;
LFileInfo *INFO;
+ LVideoSurface *surface;
+ QMediaPlayer *player;
+ bool flag;
+ QElapsedTimer timer;
+ QFuture<void> sizeThread;
bool canwrite;
bool terminate_thread; //flag for terminating the GetDirSize task
- void ReloadAppIcon();
+ void stopDirSize();
+
void GetDirSize(const QString dirname) const; //function to get folder size
+ void SyncFileInfo();
+
+ void syncXdgStruct(XDGDesktop*);
+
+ bool saveFile(QString path);
+ QString findOpenDirFile(bool isdir = false);
+
signals:
void folder_size_changed(quint64 size, quint64 files, quint64 folders, bool finished) const; //Signal for updating the folder size asynchronously
private slots:
+ void SetupNewFile();
//Initialization functions
void SetupConnections();
//UI Buttons
- void on_push_close_clicked();
- void on_push_save_clicked();
+ void closeApplication();
+ void save_clicked();
+ void save_as_local_clicked();
+ void save_as_register_clicked();
+ void open_dir_clicked();
+ void open_file_clicked();
void getXdgCommand(QString prev = "");
- //void on_tool_xdg_getCommand_clicked(QString prev = "");
void on_tool_xdg_getDir_clicked();
void on_push_xdg_getIcon_clicked();
//XDG Value Changed
+ bool checkXDGValidity();
void xdgvaluechanged();
- //Folder size
- void refresh_folder_size(quint64 size, quint64 files, quint64 folders, bool finished); //Slot for updating the folder size asynchronously
+ //Folder size
+ void refresh_folder_size(quint64 size, quint64 files, quint64 folders, bool finished); //Slot for updating the folder size asynchronously
};
#endif
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui
index 51657ba1..217c1a10 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui
+++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.ui
@@ -1,432 +1,652 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainUI</class>
- <widget class="QDialog" name="MainUI">
+ <widget class="QMainWindow" name="MainUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>349</width>
- <height>354</height>
+ <width>800</width>
+ <height>658</height>
</rect>
</property>
<property name="windowTitle">
<string>File Information</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>1</number>
- </property>
- <widget class="QWidget" name="tab_file">
- <attribute name="title">
- <string>File Information</string>
- </attribute>
- <layout class="QFormLayout" name="formLayout">
- <property name="labelAlignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_file_icon">
- <property name="text">
- <string notr="true">icon</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="0" colspan="2">
- <widget class="Line" name="line_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Owner:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLabel" name="label_file_owner">
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Group:</string>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QLabel" name="label_file_group">
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>Permissions:</string>
- </property>
- </widget>
- </item>
- <item row="10" column="0" colspan="2">
- <widget class="Line" name="line_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="11" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Created:</string>
- </property>
- </widget>
- </item>
- <item row="11" column="1">
- <widget class="QLabel" name="label_file_created">
- <property name="toolTip">
- <string>Note: The time a file was created might be more recent than the time modified if the file permissions were changed recently.</string>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="12" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Last Modified:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Type:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>MimeType:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="label_file_mimetype">
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_file_type">
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="7" column="1">
- <widget class="QLabel" name="label_file_perms">
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="12" column="1">
- <widget class="QLabel" name="label_file_modified">
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>File Size:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="label_file_size">
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_file_name">
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_deskedit">
- <attribute name="title">
- <string>Edit Shortcut</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>2</number>
- </property>
- <property name="leftMargin">
- <number>4</number>
- </property>
- <property name="topMargin">
- <number>4</number>
- </property>
- <property name="rightMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>4</number>
- </property>
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="3" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblWorkingDir">
- <property name="text">
- <string>Working Dir:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QCheckBox" name="check_xdg_startupNotify">
- <property name="text">
- <string>Use startup notification</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="line_xdg_wdir">
- <property name="enabled">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="4" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblIcon">
- <property name="text">
- <string>Icon:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblCommand">
- <property name="text">
- <string>Command:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblComment">
- <property name="text">
- <string>Comment:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="line_xdg_command"/>
- </item>
- <item row="6" column="1">
- <widget class="QCheckBox" name="check_xdg_useTerminal">
- <property name="text">
- <string>Run in terminal</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblName">
- <property name="text">
- <string>Name:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0" alignment="Qt::AlignRight">
- <widget class="QLabel" name="lblOptions">
- <property name="text">
- <string>Options</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2">
- <widget class="QLineEdit" name="line_xdg_name"/>
- </item>
- <item row="1" column="1" colspan="2">
- <widget class="QLineEdit" name="line_xdg_comment"/>
- </item>
- <item row="2" column="2">
- <widget class="QToolButton" name="tool_xdg_getCommand">
- <property name="text">
- <string notr="true"/>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QToolButton" name="tool_xdg_getDir">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QToolButton" name="push_xdg_getIcon">
- <property name="maximumSize">
- <size>
- <width>275</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>No Icon</string>
- </property>
- <property name="iconSize">
- <size>
- <width>64</width>
- <height>64</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="push_save">
- <property name="text">
- <string>Save</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
+ <property name="windowIcon">
+ <iconset theme="document-search">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="tab_file">
+ <attribute name="title">
+ <string>File Information</string>
+ </attribute>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="labelAlignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_file_icon">
+ <property name="text">
+ <string notr="true">icon</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="Line" name="line_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Owner:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="label_file_owner">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Group:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QLabel" name="label_file_group">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Permissions:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="0" colspan="2">
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Created:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="1">
+ <widget class="QLabel" name="label_file_created">
+ <property name="toolTip">
+ <string>Note: The time a file was created might be more recent than the time modified if the file permissions were changed recently.</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="12" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Last Modified:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>MimeType:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_file_mimetype">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_file_type">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QLabel" name="label_file_perms">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="12" column="1">
+ <widget class="QLabel" name="label_file_modified">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>File Size:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="label_file_size">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_file_name">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
- </item>
- <item>
- <widget class="QToolButton" name="push_close">
- <property name="text">
- <string>Close</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::DelayedPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
+ <widget class="QWidget" name="tab_deskedit">
+ <attribute name="title">
+ <string>XDG Shortcut</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="leftMargin">
+ <number>4</number>
+ </property>
+ <property name="topMargin">
+ <number>4</number>
+ </property>
+ <property name="rightMargin">
+ <number>4</number>
+ </property>
+ <property name="bottomMargin">
+ <number>4</number>
+ </property>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="3" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblWorkingDir">
+ <property name="text">
+ <string>Working Dir:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QCheckBox" name="check_xdg_startupNotify">
+ <property name="text">
+ <string>Use startup notification</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="line_xdg_wdir">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblIcon">
+ <property name="text">
+ <string>Icon:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblCommand">
+ <property name="text">
+ <string>Command:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblComment">
+ <property name="text">
+ <string>Comment:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="line_xdg_command"/>
+ </item>
+ <item row="6" column="1">
+ <widget class="QCheckBox" name="check_xdg_useTerminal">
+ <property name="text">
+ <string>Run in terminal</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblName">
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" alignment="Qt::AlignRight">
+ <widget class="QLabel" name="lblOptions">
+ <property name="text">
+ <string>Options</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QLineEdit" name="line_xdg_name"/>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QLineEdit" name="line_xdg_comment"/>
+ </item>
+ <item row="2" column="2">
+ <widget class="QToolButton" name="tool_xdg_getCommand">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>42</height>
+ </size>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="icon">
+ <iconset theme="edit-find">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QToolButton" name="tool_xdg_getDir">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>42</height>
+ </size>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="icon">
+ <iconset theme="edit-find">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_xdg_icon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>64</width>
+ <height>64</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>64</width>
+ <height>64</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="line_xdg_icon"/>
+ </item>
+ </layout>
+ </item>
+ <item row="4" column="2">
+ <widget class="QToolButton" name="push_xdg_getIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>20000</width>
+ <height>42</height>
+ </size>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>2</width>
+ <height>2</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="icon">
+ <iconset theme="edit-find">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_xdg_statusicon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_xdg_status">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <italic>true</italic>
+ </font>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
- </item>
- </layout>
- </item>
- </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>39</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>File</string>
+ </property>
+ <widget class="QMenu" name="menuSave_As">
+ <property name="title">
+ <string>Save As</string>
+ </property>
+ <property name="icon">
+ <iconset theme="document-save">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <addaction name="actionLocal_Shortcut"/>
+ <addaction name="actionRegister_Shortcut"/>
+ </widget>
+ <addaction name="actionNew_Shortcut"/>
+ <addaction name="separator"/>
+ <addaction name="actionOpen_File"/>
+ <addaction name="actionOpen_Directory"/>
+ <addaction name="separator"/>
+ <addaction name="actionSave_Shortcut"/>
+ <addaction name="menuSave_As"/>
+ <addaction name="separator"/>
+ <addaction name="actionQuit"/>
+ </widget>
+ <addaction name="menuFile"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="actionOpen_File">
+ <property name="icon">
+ <iconset theme="document-open">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="text">
+ <string>Open File</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
+ <property name="shortcutContext">
+ <enum>Qt::ApplicationShortcut</enum>
+ </property>
+ </action>
+ <action name="actionQuit">
+ <property name="icon">
+ <iconset theme="window-close">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="text">
+ <string>Quit</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
+ <property name="shortcutContext">
+ <enum>Qt::ApplicationShortcut</enum>
+ </property>
+ </action>
+ <action name="actionSave_Shortcut">
+ <property name="icon">
+ <iconset theme="document-save">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="text">
+ <string>Save Shortcut</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+S</string>
+ </property>
+ <property name="shortcutContext">
+ <enum>Qt::ApplicationShortcut</enum>
+ </property>
+ </action>
+ <action name="actionLocal_Shortcut">
+ <property name="icon">
+ <iconset theme="document-new">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="text">
+ <string>Local Shortcut</string>
+ </property>
+ </action>
+ <action name="actionRegister_Shortcut">
+ <property name="icon">
+ <iconset theme="bookmark-new">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="text">
+ <string>Register Shortcut</string>
+ </property>
+ </action>
+ <action name="actionOpen_Directory">
+ <property name="icon">
+ <iconset theme="folder-open">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="text">
+ <string>Open Directory</string>
+ </property>
+ </action>
+ <action name="actionNew_Shortcut">
+ <property name="icon">
+ <iconset theme="document-new">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="text">
+ <string>New Shortcut</string>
+ </property>
+ </action>
</widget>
- <layoutdefault spacing="6" margin="11"/>
- <tabstops>
- <tabstop>line_xdg_name</tabstop>
- <tabstop>line_xdg_comment</tabstop>
- <tabstop>line_xdg_command</tabstop>
- <tabstop>line_xdg_wdir</tabstop>
- <tabstop>check_xdg_startupNotify</tabstop>
- <tabstop>check_xdg_useTerminal</tabstop>
- <tabstop>tool_xdg_getCommand</tabstop>
- <tabstop>tool_xdg_getDir</tabstop>
- </tabstops>
<resources/>
<connections/>
</ui>
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro b/src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro
index bbaf842e..14345f50 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro
+++ b/src-qt5/desktop-utils/lumina-fileinfo/lumina-fileinfo.pro
@@ -1,7 +1,7 @@
include("$${PWD}/../../OS-detect.pri")
QT += core gui
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets concurrent
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets concurrent multimedia
TARGET = lumina-fileinfo
@@ -13,6 +13,7 @@ target.path = $${L_BINDIR}
include(../../core/libLumina/LUtils.pri) #includes LUtils
include(../../core/libLumina/LuminaXDG.pri)
#include(../../core/libLumina/LuminaSingleApplication.pri)
+include(../../core/libLumina/LVideoLabel.pri)
include(../../core/libLumina/LuminaThemes.pri)
SOURCES += main.cpp\
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/main.cpp b/src-qt5/desktop-utils/lumina-fileinfo/main.cpp
index a602f290..ce62399d 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/main.cpp
+++ b/src-qt5/desktop-utils/lumina-fileinfo/main.cpp
@@ -11,46 +11,26 @@ int main(int argc, char ** argv)
{
LTHEME::LoadCustomEnvSettings();
QApplication a(argc, argv);
- a.setAttribute(Qt::AA_UseHighDpiPixmaps);
+ a.setAttribute(Qt::AA_UseHighDpiPixmaps);
LUtils::LoadTranslation(&a, "l-fileinfo");
- //LuminaThemeEngine theme(&a);
//Read the input variables
QString path = "";
QString flag = "";
for(int i=1; i<argc; i++){
- if( QString(argv[i]).startsWith("-") ){ flag = QString(argv[i]); }
- else{ path = QString(argv[i]); break; }
+ QString tmp(argv[i]);
+ if( tmp=="--new-application" ){ flag = "APP"; }
+ else if( tmp=="--new-link" ){ flag = "LINK"; }
+ else if(!tmp.startsWith("-")){ path = QString(argv[i]); break; }
}
//Check the input variables
// - path
if(!path.isEmpty()){ path = LUtils::PathToAbsolute(path); }
- // - flag
- if(!flag.isEmpty()){
- if(flag=="-application"){
- flag = "APP"; //for internal use
- }else if(flag=="-link"){
- flag = "LINK"; //for internal use
- }else{
- //Invalid flag - clear the path as well
- flag.clear();
- path.clear();
- }
- }
- if(!path.isEmpty() || !flag.isEmpty()){
+ if(path.isEmpty() && flag.isEmpty()){ flag = "APP"; }
MainUI w;
- //QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) );
w.LoadFile(path, flag);
w.show();
int retCode = a.exec();
return retCode;
- }else{
- //Show an error text and exit
- qDebug() << "ERROR: Invalid input arguments";
- qDebug() << "Usage: \"lumina-fileinfo [-application | -link] [file]";
- return 1;
- }
-
-
}
bgstack15