aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-fm/MainUI.cpp4
-rw-r--r--lumina-fm/lumina-fm.pro11
-rw-r--r--lumina-fm/widgets/DirWidget.cpp336
-rw-r--r--lumina-fm/widgets/DirWidget.h46
-rw-r--r--lumina-fm/widgets/DirWidget.ui600
5 files changed, 604 insertions, 393 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index fe9be78b..732554dd 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -1580,12 +1580,12 @@ void MainUI::ChecksumItems(){
qDebug() << " - Info:" << info;
if(info.isEmpty() || (info.length() != files.length()) ){ return; }
for(int i=0; i<info.length(); i++){
- info[i] = QString("%2 \t(%1)").arg(files[i].section("/",-1), info[i]);
+ info[i] = QString("%2 \t(%1)").arg(files[i].section("/",-1), info[i]);
}
/*QMessageBox dlg(this);
dlg.setWindowFlags( Qt::Dialog );
dlg.setWindowTitle( tr("File Checksums") );
- dlg.setInformativeText(info.join("\n"));
+ dlg.setDetailedText(info.join("\n"));
dlg.exec();*/
QMessageBox::information(this, tr("File Checksums"), info.join("\n") );
}
diff --git a/lumina-fm/lumina-fm.pro b/lumina-fm/lumina-fm.pro
index 192f96c7..2a7d0b80 100644
--- a/lumina-fm/lumina-fm.pro
+++ b/lumina-fm/lumina-fm.pro
@@ -20,7 +20,8 @@ SOURCES += main.cpp \
BMMDialog.cpp \
BackgroundWorker.cpp \
widgets/MultimediaWidget.cpp \
- widgets/SlideshowWidget.cpp
+ widgets/SlideshowWidget.cpp \
+ widgets/DirWidget.cpp
HEADERS += MainUI.h \
FODialog.h \
@@ -30,13 +31,15 @@ HEADERS += MainUI.h \
DDFileSystemModel.h \
DirData.h \
widgets/MultimediaWidget.h \
- widgets/SlideshowWidget.h
+ widgets/SlideshowWidget.h \
+ widgets/DirWidget.h
FORMS += MainUI.ui \
FODialog.ui \
BMMDialog.ui \
widgets/MultimediaWidget.ui \
- widgets/SlideshowWidget.ui
+ widgets/SlideshowWidget.ui \
+ widgets/DirWidget.ui
# RESOURCES+= lumina-fm.qrc
@@ -126,4 +129,4 @@ INSTALLS += target dotrans desktop
NO_I18N{
INSTALLS -= dotrans
-} \ No newline at end of file
+}
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp
index 75a0bc79..8e7e3b0e 100644
--- a/lumina-fm/widgets/DirWidget.cpp
+++ b/lumina-fm/widgets/DirWidget.cpp
@@ -7,8 +7,20 @@
#include "DirWidget.h"
#include "ui_DirWidget.h"
+#include <QMessageBox>
+#include <QCursor>
+#include <QClipboard>
+#include <QMimeData>
+
+#include <LuminaOS.h>
+#include <LuminaXDG.h>
+#include <LuminaUtils.h>
+
DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new Ui::DirWidget){
ui->setupUi(this); //load the designer file
+ ID = objID;
+ canmodify = false; //initial value
+ contextMenu = new QMenu(this);
setShowDetails(true);
UpdateIcons();
UpdateText();
@@ -30,12 +42,12 @@ void DirWidget::setShowDetails(bool show){
}
void DirWidget::setShowSidebar(bool show){
- this->stacked_actions->setVisible(show);
+ ui->group_actions->setVisible(show);
}
void DirWidget::setDetails(QList<DETAILTYPES> list){
listDetails = list;
- LoadDir(CDIR, CLIST); //just refresh the UI
+ emit LoadDirectory(ID, CDIR);
}
// ================
@@ -43,15 +55,19 @@ void DirWidget::setDetails(QList<DETAILTYPES> list){
// ================
void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
if(dir.isEmpty()){ return; } //nothing to do
+ QString lastdir = CDIR; //for some checks later
+ canmodify = QFileInfo(CDIR).isWritable();
CLIST = list; //save for later
CDIR = dir;
+ //Hide the extra buttons for a moment
+ ui->tool_goToPlayer->setVisible(false);
+ ui->tool_goToImages->setVisible(false);
//Determine if this is an internal ZFS snapshot
bool loadsnaps = false;
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
normalbasedir = dir.section(ZSNAPDIR,0,0)+"/"+snaprelpath; //Update the new base directory
- ui->stacked_actions->setCurrentWidget(ui->page_restore);
//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)){
@@ -61,7 +77,6 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
//This is a normal directory - prompt for snapshot information
normalbasedir = dir;
snapbasedir.clear();
- ui->stacked_actions->setCurrentWidget(ui->page_dir);
loadsnaps = true;
}
if(loadsnaps){
@@ -77,22 +92,41 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
//Need to re-create the header item as well
QTreeWidgetItem *it = new QTreeWidgetItem();
for(int t=0; t<listDetails.length(); t++){
- it->
+ switch(listDetails[t]){
+ case NAME:
+ it->setText(t,tr("Name"));
+ break;
+ case SIZE:
+ it->setText(t,tr("Size"));
+ break;
+ case TYPE:
+ it->setText(t, tr("Type"));
+ case DATEMOD:
+ it->setText(t, tr("Date Modified") );
+ break;
+ case DATECREATE:
+ it->setText(t, tr("Date Created") );
+ break;
+ }
}
ui->treeWidget->setHeaderItem(it);
}else{ ui->listWidget->clear(); }
//Now fill the display widget
+ bool hasimages, hasmultimedia;
+ hasimages = hasmultimedia = false;
for(int i=0; i<list.length(); i++){
+ hasimages = hasimages || list[i].isImage();
+ hasmultimedia = hasmultimedia || list[i].isAVFile();
if(showDetails){
- //Now create all the individual items
+ //Now create all the individual items for the details tree
QTreeWidgetItem *it = new QTreeWidgetItem();
- it->setWhatsThis(list[i].fileName());
+ it->setWhatsThis(0, list[i].fileName());
for(int t=0; t<listDetails.length(); t++){
switch(listDetails[t]){
case NAME:
it->setText(t,list[i].fileName());
if(list[i].isImage()){
- it->setIcon(t, QIcon( QPixmap(list[i].absoluteFilePath()).scaledToHeight(64) ) );
+ it->setIcon(t, QIcon( QPixmap(list[i].absoluteFilePath()).scaledToHeight(ui->treeWidget->iconSize().height()) ) );
}else{
it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"unknown") );
}
@@ -105,19 +139,45 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
case TYPE:
it->setText(t, list[i].mimetype());
case DATEMOD:
- it->setText(t, list[i].lastModified().toString(Qt:DefaultLocaleShortDate);
+ it->setText(t, list[i].lastModified().toString(Qt::DefaultLocaleShortDate) );
break;
case DATECREATE:
- it->setText(t, list[i].created().toString(Qt:DefaultLocaleShortDate);
+ it->setText(t, list[i].created().toString(Qt::DefaultLocaleShortDate) );
break;
}
}
ui->treeWidget->addTopLevelItem(it);
+ if(lastdir == CDIR+"/"+it->whatsThis(0)){
+ ui->treeWidget->setCurrentItem(it);
+ ui->treeWidget->scrollToItem(it);
+ }
}else{
-
+ //Create all the individual items for the basic list
+ QListWidgetItem *it = new QListWidgetItem();
+ it->setWhatsThis(list[i].fileName());
+ it->setText(list[i].fileName());
+ if(list[i].isImage()){
+ it->setIcon(QIcon( QPixmap(list[i].absoluteFilePath()).scaledToHeight(ui->listWidget->iconSize().height()) ) );
+ }else{
+ it->setIcon(LXDG::findIcon(list[i].iconfile(),"unknown") );
+ }
+ ui->listWidget->addItem(it);
+ if(lastdir == CDIR+"/"+it->whatsThis()){
+ ui->listWidget->setCurrentItem(it);
+ ui->listWidget->scrollToItem(it);
+ }
}
QApplication::processEvents(); //keep the UI snappy while loading a directory
}
+ //Another check to ensure the current item is visible
+ if(showDetails){
+ if(ui->treeWidget->currentItem()!=0){ ui->treeWidget->scrollToItem(ui->treeWidget->currentItem()); }
+ }else{
+ if(ui->listWidget->currentItem()!=0){ ui->listWidget->scrollToItem(ui->listWidget->currentItem()); }
+ }
+ //Now Re-enable buttons as necessary
+ ui->tool_goToPlayer->setVisible(hasimages);
+ ui->tool_goToImages->setVisible(hasmultimedia);
}
void DirWidget::LoadSnaps(QString basedir, QStringList snaps){
@@ -126,12 +186,12 @@ void DirWidget::LoadSnaps(QString basedir, QStringList snaps){
snapshots = snaps;
//Now update the UI as necessary
- ui->slider_snap->setRange(1, snaps.length()+1);
+ 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()+1; } //unknown - load the system (should never happen)
- ui->slider_snap_setValue(index);
+ ui->slider_snap->setValue(index);
}else{
ui->slider_snap->setValue(snaps.length()+1); //last item (normal system)
}
@@ -151,7 +211,7 @@ void DirWidget::UpdateIcons(){
//Snapshot buttons
ui->tool_snap_newer->setIcon(LXDG::findIcon("go-next-view","") );
ui->tool_snap_older->setIcon(LXDG::findIcon("go-previous-view","") );
- //Botton-Action Buttons
+ //Bottom-Action Buttons
ui->tool_goToImages->setIcon( LXDG::findIcon("fileview-preview","") );
ui->tool_goToPlayer->setIcon( LXDG::findIcon("applications-multimedia","") );
//Side-Action Buttons
@@ -163,29 +223,261 @@ void DirWidget::UpdateIcons(){
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","") );
- //Restore-Action Buttons
- ui->tool_restore->setIcon( LXDG::findIcon("document-revert","") );
- ui->tool_restore_over->setIcon( LXDG::findIcon("document-revert","") );
}
void DirWidget::UpdateText(){
ui->retranslateUi(this);
}
+void DirWidget::UpdateButtons(){
+ SelectionChanged();
+}
// =================
// PRIVATE
// =================
void DirWidget::setupConnections(){
//Tree Widget interaction
- connect(ui->tree_dir_view, SIGNAL(activated(const QModelIndex&)), this, SLOT(ItemRun(const QModelIndex&)) );
+ connect(ui->treeWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) );
+ connect(ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) );
+ connect(ui->treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) );
+ connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) );
+
+ /*connect(ui->tree_dir_view, SIGNAL(activated(const QModelIndex&)), this, SLOT(ItemRun(const QModelIndex&)) );
connect(ui->list_dir_view, SIGNAL(activated(const QModelIndex&)), this, SLOT(ItemRun(const QModelIndex&)) );
- connect(ui->tree_dir_view, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu(const QPoint&)) );
- connect(ui->list_dir_view, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu(const QPoint&)) );
connect(ui->tree_dir_view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(ItemSelectionChanged()) );
- connect(ui->list_dir_view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(ItemSelectionChanged()) );
+ connect(ui->list_dir_view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(ItemSelectionChanged()) );*/
+
+
+}
+
+QStringList DirWidget::currentSelection(){
+ QStringList out;
+ if(showDetails){
+ QList<QTreeWidgetItem*> sel = ui->treeWidget->selectedItems();
+ for(int i=0; i<sel.length(); i++){
+ out << sel[i]->whatsThis(0);
+ }
+ }else{
+ QList<QListWidgetItem*> sel = ui->listWidget->selectedItems();
+ for(int i=0; i<sel.length(); i++){
+ out << sel[i]->whatsThis();
+ }
+ }
+ out.removeDuplicates();
+ return out;
}
// =================
// PRIVATE SLOTS
-// ================= \ No newline at end of file
+// =================
+//UI BUTTONS
+// -- Left Action Buttons
+void DirWidget::on_tool_act_cut_clicked(){
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ return; }
+ for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
+ emit CutFiles(sel);
+}
+
+void DirWidget::on_tool_act_copy_clicked(){
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ return; }
+ for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
+ emit CopyFiles(sel);
+}
+
+void DirWidget::on_tool_act_fav_clicked(){
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ return; }
+ for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
+ emit FavoriteFiles(sel);
+}
+
+void DirWidget::on_tool_act_paste_clicked(){
+ emit PasteFiles(CDIR);
+}
+
+void DirWidget::on_tool_act_rename_clicked(){
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ return; }
+ for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
+ emit RenameFiles(sel);
+}
+
+void DirWidget::on_tool_act_rm_clicked(){
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ return; }
+ for(int i=0; i<sel.length(); i++){ sel[i] = CDIR+"/"+sel[i]; } //use absolute paths
+ emit RemoveFiles(sel);
+}
+
+void DirWidget::on_tool_act_run_clicked(){
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ return; }
+ QStringList dirs;
+ for(int i=0; i<sel.length(); i++){
+ sel[i] = CDIR+"/"+sel[i]; //use absolute paths
+ if(QFileInfo(sel[i]).isDir()){
+ dirs << sel[i];
+ }else{
+ QProcess::startDetached("lumina-open \""+sel[i]+"\"");
+ }
+ }
+ if(!dirs.isEmpty()){
+ emit LoadDirectory(ID, dirs.takeFirst()); //load the first directory in this widget
+ }
+ if(!dirs.isEmpty()){
+ emit OpenDirectories(dirs);
+ }
+}
+
+void DirWidget::on_tool_act_runwith_clicked(){
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ return; }
+ for(int i=0; i<sel.length(); i++){
+ QProcess::startDetached("lumina-open -select \""+CDIR+"/"+sel[i]+"\""); //use absolute paths
+ }
+}
+
+// -- Bottom Action Buttons
+void DirWidget::on_tool_goToImages_clicked(){
+ emit ViewFiles(CLIST);
+}
+
+void DirWidget::on_tool_goToPlayer_clicked(){
+ emit PlayFiles(CLIST);
+}
+
+// -- 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){
+ //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->label_snap->setText(tr("Current"));
+ }else{
+ ui->label_snap->setText( QFileInfo(snapbasedir+snapshots[val]).created().toString(Qt::DefaultLocaleShortDate) );
+ }
+ //Exit if a non-interactive snapshot change
+ if(!ui->group_snaps->isEnabled()){ return; } //internal change - do not try to change the actual info
+ //Determine which snapshot is now selected
+ QString dir;
+ qDebug() << "Changing snapshot:" << CDIR << val;
+ if(val >= snapshots.length() || val < 0){ //active system selected
+ qDebug() << " - Load Active system:" << normalbasedir;
+ dir = normalbasedir;
+ }else{
+ dir = snapbasedir+snapshots[val]+"/";
+ if(snaprelpath.isEmpty()){
+ //Need to figure out the relative path within the snapshot
+ snaprelpath = CDIR.section(snapbasedir.section(ZSNAPDIR,0,0), 1,1000);
+ qDebug() << " - new snapshot-relative path:" << snaprelpath;
+ }
+ dir.append(snaprelpath);
+ qDebug() << " - Load Snapshot:" << dir;
+ }
+ //Make sure this directory exists, and back up as necessary
+ while(!QFile::exists(dir) && !dir.isEmpty()){
+ dir = dir.section("/",0,-1); //back up one dir
+ }
+ if(dir.isEmpty()){ return; }
+ //Load the newly selected snapshot
+ emit LoadDirectory(ID, dir);
+}
+
+// - Other Actions without a specific button on the side
+void DirWidget::fileCheckSums(){
+ QStringList files = currentSelection();
+ if(files.isEmpty()){ return; }
+ for(int i=0; i<files.length(); i++){ files[i] = CDIR+"/"+files[i]; } //use absolute paths
+ qDebug() << "Run Checksums:" << files;
+ QStringList info = LOS::Checksums(files);
+ qDebug() << " - Info:" << info;
+ if(info.isEmpty() || (info.length() != files.length()) ){ return; }
+ for(int i=0; i<info.length(); i++){
+ info[i] = QString("%2 \t(%1)").arg(files[i].section("/",-1), info[i]);
+ }
+ /*QMessageBox dlg(this);
+ dlg.setWindowFlags( Qt::Dialog );
+ dlg.setWindowTitle( tr("File Checksums") );
+ dlg.setDetailedText(info.join("\n"));
+ dlg.exec();*/
+ QMessageBox::information(this, tr("File Checksums"), info.join("\n") );
+}
+
+void DirWidget::fileProperties(){
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ return; }
+ if(!LUtils::isValidBinary("lumina-fileinfo")){
+ //It should never get to this point due to checks earlier - but just in case...
+ QMessageBox::warning(this, tr("Missing Utility"), tr("The \"lumina-fileinfo\" utility could not be found on the system. Please install it first.") );
+ return;
+ }
+ for(int i=0; i<sel.length(); i++){
+ QProcess::startDetached("lumina-fileinfo \""+CDIR+"/"+sel[i]+"\""); //use absolute paths
+ }
+}
+
+void DirWidget::openTerminal(){
+ emit LaunchTerminal(CDIR);
+}
+
+void DirWidget::NewFile(){
+
+}
+
+void DirWidget::NewDir(){
+
+}
+
+//Browser Functions
+void DirWidget::OpenContextMenu(){
+ //First generate the context menu based on the selection
+ QStringList sel = currentSelection();
+ contextMenu->clear();
+ 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);
+}
diff --git a/lumina-fm/widgets/DirWidget.h b/lumina-fm/widgets/DirWidget.h
index 49e59454..272aba8e 100644
--- a/lumina-fm/widgets/DirWidget.h
+++ b/lumina-fm/widgets/DirWidget.h
@@ -10,6 +10,7 @@
#include <QList>
#include <QWidget>
#include <QObject>
+#include <QMenu>
#include "../DirData.h"
@@ -39,19 +40,24 @@ public slots:
void UpdateIcons();
void UpdateText();
+ //Button updates
+ void UpdateButtons();
+
private:
Ui::DirWidget *ui;
QString ID, CDIR; //unique ID assigned by the parent and the current dir path
QList<LFileInfo> CLIST; //current item list (snap or not)
QString normalbasedir, snapbasedir, snaprelpath; //for maintaining direcoty context while moving between snapshots
QStringList snapshots;
- bool showDetails; //which widget to use for showing items
+ bool showDetails, canmodify; //which widget to use for showing items
QList<DETAILTYPES> listDetails;
+ QMenu *contextMenu;
void setupConnections();
-
+ QStringList currentSelection();
+
private slots:
- //UI BUTTONS
+ //UI BUTTONS/Actions
// -- Left Action Buttons
void on_tool_act_copy_clicked();
void on_tool_act_cut_clicked();
@@ -61,9 +67,6 @@ private slots:
void on_tool_act_rm_clicked();
void on_tool_act_run_clicked();
void on_tool_act_runwith_clicked();
- // -- Left Restore Buttons
- void on_tool_restore_clicked();
- void on_tool_restore_over_clicked();
// -- Bottom Action Buttons
void on_tool_goToImages_clicked();
void on_tool_goToPlayer_clicked();
@@ -71,8 +74,35 @@ private slots:
void on_tool_snap_newer_clicked();
void on_tool_snap_older_clicked();
void on_slider_snap_valueChanged(int);
+ // - Other Actions without a specific button on the side
+ void fileCheckSums();
+ void fileProperties();
+ void openTerminal();
+ void NewFile();
+ void NewDir();
+
+ //Browser Functions
+ void OpenContextMenu();
+ void SelectionChanged();
+
signals:
- void LoadDirectory(QString, QString); //ID, dirpath
- void findSnaps(QString, QString); //ID, dirpath
+ //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)
+
+ //External App/Widget launching
+ void PlayFiles(QList<LFileInfo>); //open in multimedia player
+ void ViewFiles(QList<LFileInfo>); //open in slideshow
+ void LaunchTerminal(QString); //dirpath
+
+ //System Interactions
+ void CutFiles(QStringList); //file selection
+ void CopyFiles(QStringList); //file selection
+ void PasteFiles(QString); //current dir
+ void FavoriteFiles(QStringList); //file selection
+ void RenameFiles(QStringList); //file selection
+ void RemoveFiles(QStringList); //file selection
+
};
#endif \ No newline at end of file
diff --git a/lumina-fm/widgets/DirWidget.ui b/lumina-fm/widgets/DirWidget.ui
index 9c0a73a1..2be5515d 100644
--- a/lumina-fm/widgets/DirWidget.ui
+++ b/lumina-fm/widgets/DirWidget.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>DirView</class>
- <widget class="QWidget" name="DirView">
+ <class>DirWidget</class>
+ <widget class="QWidget" name="DirWidget">
<property name="geometry">
<rect>
<x>0</x>
@@ -15,378 +15,258 @@
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<property name="leftMargin">
- <number>0</number>
+ <number>1</number>
</property>
<property name="topMargin">
- <number>0</number>
+ <number>1</number>
</property>
<property name="rightMargin">
- <number>0</number>
+ <number>1</number>
</property>
<property name="bottomMargin">
- <number>0</number>
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>2</number>
</property>
<item row="0" column="0">
- <widget class="QStackedWidget" name="stacked_actions">
+ <widget class="QGroupBox" name="group_actions">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="currentIndex">
- <number>0</number>
+ <property name="title">
+ <string/>
</property>
- <widget class="QWidget" name="page_dir">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="leftMargin">
+ <number>0</number>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QGroupBox" name="group_actions">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QToolButton" name="tool_act_run">
- <property name="toolTip">
- <string>Open item</string>
- </property>
- <property name="statusTip">
- <string>Open item</string>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonIconOnly</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_act_runwith">
- <property name="toolTip">
- <string>Open item (select application)</string>
- </property>
- <property name="statusTip">
- <string>Open item (select application)</string>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_act_fav">
- <property name="toolTip">
- <string>Add item to personal favorites</string>
- </property>
- <property name="statusTip">
- <string>Add item to personal favorites</string>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_act_rename">
- <property name="toolTip">
- <string>Rename item</string>
- </property>
- <property name="statusTip">
- <string>Rename item</string>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_7">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_act_cut">
- <property name="toolTip">
- <string>Cut items</string>
- </property>
- <property name="statusTip">
- <string>Cut items (add to the clipboard)</string>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_act_copy">
- <property name="toolTip">
- <string>Copy items</string>
- </property>
- <property name="statusTip">
- <string>Copy items to the clipboard</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_act_paste">
- <property name="toolTip">
- <string>Paste items from clipboard</string>
- </property>
- <property name="statusTip">
- <string>Paste items from clipboard</string>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_6">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_act_rm">
- <property name="toolTip">
- <string>Delete Items</string>
- </property>
- <property name="statusTip">
- <string>Delete Items</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </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>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_restore">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <property name="topMargin">
+ <number>0</number>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QToolButton" name="tool_restore">
- <property name="statusTip">
- <string>Restore File(s)</string>
- </property>
- <property name="text">
- <string notr="true">...</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_restore_over">
- <property name="statusTip">
- <string>Restore Files(s) (Overwrite any conflicting files)</string>
- </property>
- <property name="text">
- <string notr="true">...</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QToolButton" name="tool_act_run">
+ <property name="toolTip">
+ <string>Open item</string>
+ </property>
+ <property name="statusTip">
+ <string>Open item</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonIconOnly</enum>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_act_runwith">
+ <property name="toolTip">
+ <string>Open item (select application)</string>
+ </property>
+ <property name="statusTip">
+ <string>Open item (select application)</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_act_fav">
+ <property name="toolTip">
+ <string>Add item to personal favorites</string>
+ </property>
+ <property name="statusTip">
+ <string>Add item to personal favorites</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_act_rename">
+ <property name="toolTip">
+ <string>Rename item</string>
+ </property>
+ <property name="statusTip">
+ <string>Rename item</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line_7">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_act_cut">
+ <property name="toolTip">
+ <string>Cut items</string>
+ </property>
+ <property name="statusTip">
+ <string>Cut items (add to the clipboard)</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_act_copy">
+ <property name="toolTip">
+ <string>Copy items</string>
+ </property>
+ <property name="statusTip">
+ <string>Copy items to the clipboard</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_act_paste">
+ <property name="toolTip">
+ <string>Paste items from clipboard</string>
+ </property>
+ <property name="statusTip">
+ <string>Paste items from clipboard</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_act_rm">
+ <property name="toolTip">
+ <string>Delete Items</string>
+ </property>
+ <property name="statusTip">
+ <string>Delete Items</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </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>
+ </layout>
</widget>
</item>
<item row="0" column="1">
@@ -463,6 +343,9 @@
</item>
<item>
<widget class="QTreeWidget" name="treeWidget">
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
@@ -475,6 +358,9 @@
</item>
<item>
<widget class="QListWidget" name="listWidget">
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
bgstack15