aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-08-25 15:43:53 -0400
committerKen Moore <moorekou@gmail.com>2015-08-25 15:43:53 -0400
commit88507c36076b100e26a8e2c85533d667675f9daa (patch)
tree53fc42d5b8b83924e19aa5d6618dae446ba698a4
parentDisable the "size" output of a directory in lumina-fm: this needs some better... (diff)
downloadlumina-88507c36076b100e26a8e2c85533d667675f9daa.tar.gz
lumina-88507c36076b100e26a8e2c85533d667675f9daa.tar.bz2
lumina-88507c36076b100e26a8e2c85533d667675f9daa.zip
Commit a major overhaul of lumina-fm: PLEASE TEST!!
1) Seemlessly embed the ZFS rollback options into the main dir browser (simple time slider at the top). 2) Take all the main widgets and put them into separate classes/files (widgets/*) 3) Add support for both tabs and columns for multiple directory viewing 4) Remove the "icon" view mode, and replace it with an icon sizing option (larger/smaller) 5) Add the ability for the multimedia player and slideshow viewer to be running within separate tabs while still browsing the system (new files will be added to the queue instead of replacing it) 6) Ensure that only selected files are added to the player/slideshow on demand. 7) Add the ability to zoom in/out on a slideshow image. KNOWN ISSUES: 1) The new file/dir functionality has not been replaced/re-implemented yet. 2) The drag and drop functionality has been removed until a new implementation is put in. PLEASE TEST: ZFS snapshot use, multimedia file player, browsing and other UI changes
-rw-r--r--lumina-fm/BackgroundWorker.cpp131
-rw-r--r--lumina-fm/BackgroundWorker.h47
-rw-r--r--lumina-fm/DDFileSystemModel.h36
-rw-r--r--lumina-fm/DirData.h18
-rw-r--r--lumina-fm/FODialog.cpp19
-rw-r--r--lumina-fm/MainUI-old.cpp1597
-rw-r--r--lumina-fm/MainUI-old.h238
-rw-r--r--lumina-fm/MainUI-old.ui1315
-rw-r--r--lumina-fm/MainUI.cpp1575
-rw-r--r--lumina-fm/MainUI.h155
-rw-r--r--lumina-fm/MainUI.ui1212
-rw-r--r--lumina-fm/MimeIconProvider.h67
-rw-r--r--lumina-fm/lumina-fm.pro4
-rw-r--r--lumina-fm/main.cpp2
-rw-r--r--lumina-fm/widgets/DirWidget.cpp269
-rw-r--r--lumina-fm/widgets/DirWidget.h49
-rw-r--r--lumina-fm/widgets/DirWidget.ui336
-rw-r--r--lumina-fm/widgets/MultimediaWidget.cpp5
-rw-r--r--lumina-fm/widgets/MultimediaWidget.h1
-rw-r--r--lumina-fm/widgets/SlideshowWidget.cpp43
-rw-r--r--lumina-fm/widgets/SlideshowWidget.h8
-rw-r--r--lumina-fm/widgets/SlideshowWidget.ui115
22 files changed, 1155 insertions, 6087 deletions
diff --git a/lumina-fm/BackgroundWorker.cpp b/lumina-fm/BackgroundWorker.cpp
deleted file mode 100644
index f8e036ac..00000000
--- a/lumina-fm/BackgroundWorker.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-#include "BackgroundWorker.h"
-
-#include <LuminaXDG.h>
-#include <QMediaServiceSupportedFormatsInterface>
-#include <QImageReader>
-#include <QDir>
-#include <QFileInfo>
-
-BackgroundWorker::BackgroundWorker() : QObject(){
-
-}
-
-BackgroundWorker::~BackgroundWorker(){
-
-}
-
-void BackgroundWorker::startDirChecks(QString path){
- QDir dir(path);
- //Make sure to remove any symlinks or redundency in the path
- if(dir.canonicalPath()!=path){ path = dir.canonicalPath(); dir.cd(path); }
- qDebug() << "Starting Dir Checks:" << path;
- //First check for image files
- if(imgFilter.isEmpty()){
- //Initial Run - load supported image extensions
- QList<QByteArray> fmt = QImageReader::supportedImageFormats();
- for(int i=0; i<fmt.length(); i++){ imgFilter << "*."+QString(fmt[i]).toLower(); }
- qDebug() << "Supported Image Formats:" << imgFilter;
- }
- QStringList pics = dir.entryList(imgFilter, QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase);
- if(!pics.isEmpty() && !imgFilter.isEmpty()){ emit ImagesAvailable(pics); }
-
- //Now check for multimedia files
- if(multiFilter.isEmpty()){
- //Initial Run - load supported multimedia extensions
- // (Auto-detection of supported types broken in Qt5 - just use everythings for now)
- multiFilter = LXDG::findAVFileExtensions();
- multiFilter.removeDuplicates();
- qDebug() << "Supported Multimedia Formats:" << multiFilter;
- }
- QStringList files = dir.entryList(multiFilter, QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase);
- if(!files.isEmpty() && !multiFilter.isEmpty()){ emit MultimediaAvailable(files); }
- qDebug() << " - done with audio/multimedia checks";
- //Now check for ZFS snapshots of the directory
- if(!QFileInfo(path).isWritable() ){ return; } //skip ZFS checks if can't restore to this dir
- //cdir = path;
- QStringList snapDirs;
- QString baseSnapDir;
- bool found = false;
- qDebug() << " - start searching for base snapshot directory";
- if(cdir == path && QFile::exists(csnapdir) ){
- //no need to re-search for it - just found it recently
- qDebug() << " -- Use previous dir:" << cdir << csnapdir;
- baseSnapDir= csnapdir; found=true;
- }else{
- while(dir.canonicalPath()!="/" && !found){
- qDebug() << " -- Checking for snapshot dir:" << dir.canonicalPath();
- if(dir.exists(".zfs/snapshot")){
- baseSnapDir = dir.canonicalPath()+"/.zfs/snapshot";
- found = true;
- }else{ dir.cdUp(); }
- }
- }
- qDebug() << " - done with base snapshot directory";
- cdir = path; csnapdir = baseSnapDir;
- //Now find the snapshots that contain this directory and save them
- if(found){
- qDebug() << " - start fetching snapshots";
- QString reldir = path;
- reldir.remove(baseSnapDir.section("/.zfs/snapshot",0,0)); //convert to a relative path
- dir.cd(baseSnapDir);
- snapDirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time);
- //Check that the current directory exists in each snapshot
- for(int i=0; i<snapDirs.length(); i++){
- if( !dir.exists(snapDirs[i]+"/"+reldir) ){
- snapDirs.removeAt(i);
- i--;
- }else{
- snapDirs[i] = QFileInfo(dir, snapDirs[i]+"/"+reldir).created().toString("yyyyMMddhhmmsszzz")+"::::"+snapDirs[i];
- }
- }
- qDebug() << " - done fetching snapshots";
- snapDirs.sort();
- //Sort the snapshots by time (newest last) and format them
- for(int i=0; i<snapDirs.length(); i++){
- snapDirs[i] = dir.absolutePath()+"/"+snapDirs[i].section("::::",1,50)+"/"+reldir;
- }
- if(!snapDirs.isEmpty()){ emit SnapshotsAvailable(baseSnapDir, snapDirs); }
- qDebug() << "Found snapshots";
- }
-}
-
-
-void BackgroundWorker::createStatusBarMsg(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles){
-
- //collect some statistics of dir and display them in statusbar
- //Get the total size of the items
- double totalSizes = 0;
- int numberFolders = 0;
- int numberFiles = 0;
- for(int i=0; i<fileList.length(); i++){
- if(!fileList[i].isDir()){
- numberFiles++;
- totalSizes += fileList[i].size(); //in Bytes
- }
- else { numberFolders++; }
- }
- //Convert the size into display units
- static QStringList units = QStringList() << tr("B") << tr("KB") << tr("MB") << tr("GB") << tr("TB");
- int cunit = 0;
- while(cunit < units.length() && totalSizes > 1024){
- cunit++;
- totalSizes = totalSizes/1024;
- }
- //Assemble the message
- QString msgStatusBar = QString(tr("%1: %2 / %3: %4")).arg(messageFolders).arg(numberFolders).arg(messageFiles).arg(numberFiles);
-
- if(totalSizes > 0){
- totalSizes = qRound(totalSizes*100)/100.0; //round to 2 decimel places
- msgStatusBar += " "+QString(tr("Total size: %1 %2")).arg(QString::number(totalSizes), units[cunit]);
- }
- //If a path given, get the total capacity of it (percantage)
- if (!path.isEmpty()) { //path could be empty when fileList is based on user's selection
- QString capacity = LOS::FileSystemCapacity(path) ;
- if (msgStatusBar.isEmpty()) msgStatusBar += QString(tr("Capacity: %1")).arg(capacity);
- else msgStatusBar += " "+QString(tr("Capacity: %1")).arg(capacity);
- }
- //Emit the signal to show this on the UI
- if (!msgStatusBar.isEmpty()){
- emit Si_DisplayStatusBar(msgStatusBar);
- }
-}
diff --git a/lumina-fm/BackgroundWorker.h b/lumina-fm/BackgroundWorker.h
deleted file mode 100644
index 72060cad..00000000
--- a/lumina-fm/BackgroundWorker.h
+++ /dev/null
@@ -1,47 +0,0 @@
-//===========================================
-// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-// This is the background class for running long-lived calculations
-//===========================================
-#ifndef _LUMINA_FILE_MANAGER_BACKGROUND_WORKER_H
-#define _LUMINA_FILE_MANAGER_BACKGROUND_WORKER_H
-
-#include <QObject>
-#include <QStringList>
-#include <QString>
-#include <QFileInfo>
-#include <QDir>
-#include <QDateTime>
-
-#include <LuminaOS.h>
-
-
-class BackgroundWorker : public QObject{
- Q_OBJECT
-public:
- BackgroundWorker();
- ~BackgroundWorker();
-
-private:
- QStringList multiFilter, imgFilter;
- QString cdir, csnapdir; //last directory checked (and base snapshot dir found)
- QString ItemsInstatusBar(QFileInfoList, QString);
-
-public slots:
- //Kickoff processes with these slots
- // and then listen for the appropriate signals when finished
- void startDirChecks(QString path);
- void createStatusBarMsg(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles);
-
-signals:
- void ImagesAvailable(QStringList files);
- void MultimediaAvailable(QStringList files);
- void SnapshotsAvailable(QString basedir, QStringList snappaths);
- void Si_DisplayStatusBar(QString);
-
-};
-
-#endif
diff --git a/lumina-fm/DDFileSystemModel.h b/lumina-fm/DDFileSystemModel.h
deleted file mode 100644
index caa83b0e..00000000
--- a/lumina-fm/DDFileSystemModel.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//===========================================
-// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-// This is a simple subclassed QFileSystemModel to enable drag and drop
-// (and moving) but disable all the other filesystem modifications
-//===========================================
-#ifndef _LUMINA_FILE_MANAGER_DDFILESYSTEMMODEL_H
-#define _LUMINA_FILE_MANAGER_DDFILESYSTEMMODEL_H
-
-#include <QFileSystemModel>
-#include <QObject>
-
-class DDFileSystemModel : public QFileSystemModel{
- Q_OBJECT
-public:
- DDFileSystemModel(QObject *parent = 0) : QFileSystemModel(parent){
- this->setReadOnly(false); //need this to enable DnD
- }
- ~DDFileSystemModel(){}
-
- virtual Qt::ItemFlags flags(const QModelIndex &index) const {
- //First get all the flags from the standard QFileSystemModel
- Qt::ItemFlags defaultflags = QFileSystemModel::flags(index);
- //Now if it has the "Editable" flag set - remove it
- if(defaultflags & Qt::ItemIsEditable){
- defaultflags ^= Qt::ItemIsEditable;
- }
-
- return defaultflags;
- }
-};
-
-#endif \ No newline at end of file
diff --git a/lumina-fm/DirData.h b/lumina-fm/DirData.h
index cbfa1855..bd2657e1 100644
--- a/lumina-fm/DirData.h
+++ b/lumina-fm/DirData.h
@@ -20,6 +20,8 @@
#define ZSNAPDIR QString("/.zfs/snapshot/")
+#define DEBUG 0
+
//Need some extra information not usually available by a QFileInfo
class LFileInfo : public QFileInfo{
private:
@@ -71,7 +73,8 @@ public:
//Functions for accessing the extra information
// -- Return the mimetype for the file
QString mimetype(){
- return mime;
+ if(mime=="inode/directory"){ return ""; }
+ else{ return mime; }
}
// -- Return the icon to use for this file
@@ -80,7 +83,9 @@ public:
return icon;
}else{
if(!mime.isEmpty()){
- return mime.replace("/","-");
+ QString tmp = mime;
+ tmp.replace("/","-");
+ return tmp;
}else if(this->isExecutable()){
return "application-x-executable";
}
@@ -109,6 +114,7 @@ public:
return (mime.startsWith("audio/") || mime.startsWith("video/") );
}
};
+typedef QList<LFileInfo> LFileInfoList;
class LDirInfoList{
public:
@@ -187,7 +193,7 @@ private:
QHash<QString, LDirInfoList> HASH; //Where we cache any info for rapid access later
signals:
- void DirDataAvailable(QString, QString, QList<LFileInfo>); //[ID, Dirpath, DATA]
+ void DirDataAvailable(QString, QString, LFileInfoList); //[ID, Dirpath, DATA]
void SnapshotDataAvailable(QString, QString, QStringList); //[ID, BaseSnapDir, SnapNames]
public:
@@ -204,6 +210,7 @@ public:
public slots:
void GetDirData(QString ID, QString dirpath){
+ if(DEBUG){ qDebug() << "GetDirData:" << ID << dirpath; }
//The ID is used when returning the info in a moment
//Make sure to use the canonical path in the HASH search - don't use
QString canon = QFileInfo(dirpath).canonicalFilePath();
@@ -218,10 +225,12 @@ public slots:
HASH[canon].update(showHidden);
}
}
+ if(DEBUG){ qDebug() << " -- Dir Data Found:" << ID << dirpath << HASH.value(canon).list.length(); }
emit DirDataAvailable(ID, dirpath, HASH.value(canon).list);
}
void GetSnapshotData(QString ID, QString dirpath){
+ if(DEBUG){ qDebug() << "GetSnapshotData:" << ID << dirpath; }
QString base; QStringList snaps;
//Only check if ZFS is flagged as available
if(zfsavailable){
@@ -239,11 +248,12 @@ public slots:
//Good snapshot directory found - read off the current snapshots (can change regularly - don't cache this)
base = HASH.value(dirpath).snapdir;
QDir dir(base);
- snaps = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time);
+ snaps = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time |QDir::Reversed );
//NOTE: snaps are sorted oldest -> newest
}
}
+ if(DEBUG){ qDebug() << " -- Snap Data Found:" << ID << base << snaps; }
emit SnapshotDataAvailable(ID, base, snaps);
}
diff --git a/lumina-fm/FODialog.cpp b/lumina-fm/FODialog.cpp
index d182ed06..a4d9afa7 100644
--- a/lumina-fm/FODialog.cpp
+++ b/lumina-fm/FODialog.cpp
@@ -10,6 +10,8 @@
#include <QApplication>
#include <QFontMetrics>
+#define DEBUG 1
+
FODialog::FODialog(QWidget *parent) : QDialog(parent), ui(new Ui::FODialog){
ui->setupUi(this); //load the designer file
ui->label->setText(tr("Calculating"));
@@ -109,7 +111,8 @@ bool FODialog::CheckOverwrite(){
QMessageBox::StandardButton ans = QMessageBox::question(this, tr("Overwrite Files?"), tr("Do you want to overwrite the existing files?")+"\n"+tr("Note: It will just add a number to the filename otherwise.")+"\n\n"+existing.join(", "), QMessageBox::YesToAll | QMessageBox::NoToAll | QMessageBox::Cancel, QMessageBox::NoToAll);
if(ans==QMessageBox::NoToAll){ Worker->overwrite = 0; } //don't overwrite
else if(ans==QMessageBox::YesToAll){ Worker->overwrite = 1; } //overwrite
- else{ ok = false; } //cancel operations
+ else{ qDebug() << " - Cancelled"; ok = false; } //cancel operations
+ if(DEBUG){ qDebug() << " - Overwrite:" << Worker->overwrite; }
}
}
QApplication::processEvents();
@@ -242,7 +245,7 @@ QStringList FOWorker::copyItem(QString oldpath, QString newpath){
// ==== PRIVATE SLOTS ====
void FOWorker::slotStartOperations(){
- //qDebug() << "Start File operations" << isRM << isCP << isMV << ofiles << nfiles;
+ if(DEBUG){ qDebug() << "Start File operations" << isRM << isCP << isMV << ofiles << nfiles << overwrite; }
//Now setup the UI
/*ui->progressBar->setRange(0,ofiles.length());
ui->progressBar->setValue(0);
@@ -269,13 +272,15 @@ void FOWorker::slotStartOperations(){
if(isRM){ //only old files
olist << subfiles(ofiles[i], false); //dirs need to be last for removals
}else if(isCP || isRESTORE){
- if(nfiles[i] == ofiles[i]){
+ if(nfiles[i] == ofiles[i] && overwrite==1){
//Trying to copy a file/dir to itself - skip it
continue;
}
if(QFile::exists(nfiles[i])){
- if(!overwrite){
+ if(overwrite!=1){
+ qDebug() << " - Get New Filename:" << nfiles[i];
nfiles[i] = newFileName(nfiles[i]); //prompt for new file name up front before anything starts
+ qDebug() << " -- nfiles[i]";
}
}
QStringList subs = subfiles(ofiles[i], true); //dirs need to be first for additions
@@ -294,7 +299,7 @@ void FOWorker::slotStartOperations(){
}else{
//Check for existance of the new name
if(QFile::exists(nfiles[i])){
- if(!overwrite){
+ if(overwrite!=1){
nfiles[i] = newFileName(nfiles[i]); //prompt for new file name up front before anything starts
}
}
@@ -317,7 +322,7 @@ void FOWorker::slotStartOperations(){
QApplication::processEvents();*/
emit startingItem(i+1,olist.length(), olist[i],nlist[i]);
if(QFile::exists(nlist[i])){
- if(overwrite){
+ if(overwrite==1){
errlist << removeItem(nlist[i], true); //recursively remove the file/dir since we are supposed to overwrite it
}
}
@@ -332,7 +337,7 @@ void FOWorker::slotStartOperations(){
emit startingItem(i+1,olist.length(), olist[i], nlist[i]);
//Clean up any overwritten files/dirs
if(QFile::exists(nlist[i])){
- if(overwrite){
+ if(overwrite==1){
errlist << removeItem(nlist[i], true); //recursively remove the file/dir since we are supposed to overwrite it
}
}
diff --git a/lumina-fm/MainUI-old.cpp b/lumina-fm/MainUI-old.cpp
deleted file mode 100644
index 732554dd..00000000
--- a/lumina-fm/MainUI-old.cpp
+++ /dev/null
@@ -1,1597 +0,0 @@
-//===========================================
-// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-#include "MainUI.h"
-#include "ui_MainUI.h"
-
-#include <QImageWriter>
-#include <QFileInfo>
-
-#define DEBUG 0
-
-MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
- //for Signal/slot we must register the Typedef of QFileInfoList
- qRegisterMetaType<QFileInfoList>("QFileInfoList");
- ui->setupUi(this);
- if(DEBUG){ qDebug() << "Initilization:"; }
- //Be careful about the QSettings setup, it must match the lumina-desktop setup
- QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
- settings = new QSettings( QSettings::UserScope, "LuminaDE", "lumina-fm", this);
- favdir = QDir::homePath()+"/.lumina/favorites/"; //save this for later
- syncTimer = new QTimer(this);
- syncTimer->setInterval(200); //1/5 second (collect as many signals/slots as necessary
- syncTimer->setSingleShot(true);
- //Reset the UI to the previously used size (if possible)
- if(DEBUG){ qDebug() << " - Reset window size"; }
- int height = settings->value("geometry/height",-1).toInt();
- if(height>100 && height <= QApplication::desktop()->availableGeometry(this).height()){ this->resize(this->width(), height); }
- int width = settings->value("geometry/width",-1).toInt();
- if(width>100 && width <= QApplication::desktop()->availableGeometry(this).width()){ this->resize(width, this->height() ); }
- //initialize the non-ui widgets
- if(DEBUG){ qDebug() << " - Tab Bar Setup"; }
- tabBar = new QTabBar(this);
- tabBar->setTabsClosable(true);
- tabBar->setMovable(true); //tabs are independant - so allow the user to sort them
- tabBar->setShape(QTabBar::RoundedNorth);
- tabBar->setFocusPolicy(Qt::NoFocus);
- ui->verticalLayout_browser->insertWidget(0,tabBar);
- currentDir = new QLineEdit(this);
- ui->toolBar->insertWidget(ui->actionBookMark, currentDir);
- currentDir->setFocusPolicy(Qt::StrongFocus);
- if(DEBUG){ qDebug() << " - Threading"; }
- workThread = new QThread;
- workThread->setObjectName("Lumina-fm filesystem worker");
- worker = new BackgroundWorker;
- worker->moveToThread(workThread);
- if(DEBUG){ qDebug() << " - File System Model"; }
- fsmod = new DDFileSystemModel(this);
- fsmod->setRootPath("/");
- //fsmod->setReadOnly(false); //required for DnD, but also enables a lot of other stuff
- //qDebug() << "DnD options:" << fsmod->supportedDropActions();
- ui->tree_dir_view->setModel(fsmod);
- ui->tree_dir_view->sortByColumn(0, Qt::AscendingOrder);
- ui->tree_dir_view->setColumnWidth(0,200);
- ui->tree_dir_view->setColumnWidth(1,80); //size column should be small
- ui->tree_dir_view->setColumnWidth(2,80); //type column should be small
- ui->list_dir_view->setModel(fsmod);
- dirCompleter = new QCompleter(fsmod, this);
- dirCompleter->setModelSorting( QCompleter::CaseInsensitivelySortedModel );
- currentDir->setCompleter(dirCompleter);
- snapmod = new QFileSystemModel(this);
- ui->tree_zfs_dir->setModel(snapmod);
- ui->tree_zfs_dir->sortByColumn(0, Qt::AscendingOrder);
- if(DEBUG){ qDebug() << " - Icon Provider"; }
- iconProv = new MimeIconProvider();
- fsmod->setIconProvider(iconProv);
- snapmod->setIconProvider(iconProv);
- if(DEBUG){ qDebug() << " - Context Menu"; }
- contextMenu = new QMenu(this);
- radio_view_details = new QRadioButton(tr("Detailed List"), this);
- radio_view_list = new QRadioButton(tr("Basic List"), this);
- radio_view_icons = new QRadioButton(tr("Icons"), this);
- detWA = new QWidgetAction(this);
- detWA->setDefaultWidget(radio_view_details);
- listWA = new QWidgetAction(this);
- listWA->setDefaultWidget(radio_view_list);
- icoWA = new QWidgetAction(this);
- icoWA->setDefaultWidget(radio_view_icons);
- ui->menuView->addAction(detWA);
- ui->menuView->addAction(listWA);
- ui->menuView->addAction(icoWA);
- //Setup the special Phonon widgets
- if(DEBUG){ qDebug() << " - Multimedia Widgets"; }
- mediaObj = new QMediaPlayer(this);
- mediaObj->setVolume(100);
- mediaObj->setNotifyInterval(500); //only every 1/2 second update
- videoDisplay = new QVideoWidget(this);
- videoDisplay->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- ui->videoLayout->addWidget(videoDisplay);
- mediaObj->setVideoOutput(videoDisplay);
- videoDisplay->setVisible(false);
- playerSlider = new QSlider(this);
- playerSlider->setOrientation(Qt::Horizontal);
- ui->videoControlLayout->insertWidget(4, playerSlider);
- ui->tool_player_stop->setEnabled(false); //nothing to stop yet
- ui->tool_player_pause->setVisible(false); //nothing to pause yet
- playerSlider->setEnabled(false); //nothing to seek yet
- //Setup any specialty keyboard shortcuts
- if(DEBUG){ qDebug() << " - Keyboard Shortcuts"; }
- nextTabLShort = new QShortcut( QKeySequence(tr("Shift+Left")), this);
- nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this);
- closeTabShort = new QShortcut( QKeySequence(tr("Ctrl+W")), this);
- copyFilesShort = new QShortcut( QKeySequence(tr("Ctrl+C")), this);
- pasteFilesShort = new QShortcut( QKeySequence(tr("Ctrl+V")), this);
- cutFilesShort = new QShortcut( QKeySequence(tr("Ctrl+X")), this);
- deleteFilesShort = new QShortcut( QKeySequence(tr("Delete")), this);
- //Finish loading the interface
- workThread->start();
- if(DEBUG){ qDebug() << " - Icons"; }
- setupIcons();
- if(DEBUG){ qDebug() << " - Connections"; }
- setupConnections();
- if(DEBUG){ qDebug() << " - Settings"; }
- loadSettings();
- if(DEBUG){ qDebug() << " - Bookmarks"; }
- RebuildBookmarksMenu();
- if(DEBUG){ qDebug() << " - Devices"; }
- RebuildDeviceMenu();
- //Make sure we start on the browser page
- if(DEBUG){ qDebug() << " - Load Browser Page"; }
- goToBrowserPage();
- if(DEBUG){ qDebug() << " - Done with init"; }
-}
-
-MainUI::~MainUI(){
- workThread->quit();
- workThread->wait();
-}
-
-void MainUI::OpenDirs(QStringList dirs){
- QStringList invalid;
- for(int i=0; i<dirs.length(); i++){
- //Add this directory in a new tab
- if(dirs[i].endsWith("/")){ dirs[i].chop(1); }
- if(!QFile::exists(dirs[i])){ invalid << dirs[i]; continue; }
- if(DEBUG){ qDebug() << "Open Directory:" << dirs[i]; }
- int index = tabBar->addTab( dirs[i].section("/",-1) );
- tabBar->setTabWhatsThis( index, dirs[i] );
- if(index==0){ setCurrentDir(dirs[i]); }//display this as the current dir
- }
- tabBar->setVisible( tabBar->count() > 1 );
- if(!invalid.isEmpty()){
- QMessageBox::warning(this, tr("Invalid Directories"), tr("The following directories are invalid and could not be opened:")+"\n"+invalid.join(", ") );
- }
-}
-
-//==========
-// PRIVATE
-//==========
-void MainUI::setupIcons(){
- this->setWindowIcon( LXDG::findIcon("Insight-FileManager","") );
-
- //Setup all the icons using libLumina
- ui->actionClose->setIcon( LXDG::findIcon("application-exit","") );
- ui->actionNew_Tab->setIcon( LXDG::findIcon("tab-new-background","") );
- //ui->action_Preferences->setIcon( LXDG::findIcon("configure","") );
- ui->actionUpDir->setIcon( LXDG::findIcon("go-up","") );
- ui->actionBack->setIcon( LXDG::findIcon("go-previous","") );
- ui->actionHome->setIcon( LXDG::findIcon("go-home","") );
- ui->actionBookMark->setIcon( LXDG::findIcon("bookmarks","") );
- ui->actionBackToBrowser->setIcon( LXDG::findIcon("go-previous","") );
- ui->actionManage_Bookmarks->setIcon( LXDG::findIcon("bookmarks-organize","") );
- ui->actionScan->setIcon( LXDG::findIcon("system-search","") );
- ui->actionSearch->setIcon( LXDG::findIcon("edit-find","") );
-
- //Browser page
- ui->tool_addNewFile->setIcon( LXDG::findIcon("document-new",""));
- ui->tool_addToDir->setIcon( LXDG::findIcon("folder-new","") );
- ui->tool_goToImages->setIcon( LXDG::findIcon("fileview-preview","") );
- ui->tool_goToPlayer->setIcon( LXDG::findIcon("applications-multimedia","") );
- ui->tool_goToRestore->setIcon( LXDG::findIcon("document-revert","") );
- ui->tool_act_run->setIcon( LXDG::findIcon("run-build-file","") );
- ui->tool_act_runwith->setIcon( LXDG::findIcon("run-build-configure","") );
- ui->tool_act_cut->setIcon( LXDG::findIcon("edit-cut","") );
- ui->tool_act_copy->setIcon( LXDG::findIcon("edit-copy","") );
- ui->tool_act_paste->setIcon( LXDG::findIcon("edit-paste","") );
- ui->tool_act_rename->setIcon( LXDG::findIcon("edit-rename","") );
- ui->tool_act_rm->setIcon( LXDG::findIcon("edit-delete","") );
- ui->tool_act_fav->setIcon( LXDG::findIcon("bookmark-toolbar","") );
-
- //Multimedia Player page
- ui->tool_player_next->setIcon( LXDG::findIcon("media-skip-forward","") );
- ui->tool_player_prev->setIcon( LXDG::findIcon("media-skip-backward","") );
- ui->tool_player_pause->setIcon( LXDG::findIcon("media-playback-pause","") );
- ui->tool_player_play->setIcon( LXDG::findIcon("media-playback-start","") );
- ui->tool_player_stop->setIcon( LXDG::findIcon("media-playback-stop","") );
-
- //Slideshow page
- ui->tool_image_goBegin->setIcon( LXDG::findIcon("go-first-view","") );
- ui->tool_image_goEnd->setIcon( LXDG::findIcon("go-last-view","") );
- ui->tool_image_goPrev->setIcon( LXDG::findIcon("go-previous-view","") );
- ui->tool_image_goNext->setIcon( LXDG::findIcon("go-next-view","") );
- ui->tool_image_remove->setIcon( LXDG::findIcon("edit-delete","") );
- ui->tool_image_rotateleft->setIcon( LXDG::findIcon("object-rotate-left","") );
- ui->tool_image_rotateright->setIcon( LXDG::findIcon("object-rotate-right","") );
-
- //ZFS Restore page
- ui->tool_zfs_nextSnap->setIcon( LXDG::findIcon("go-next-view","") );
- ui->tool_zfs_prevSnap->setIcon( LXDG::findIcon("go-previous-view","") );
- ui->tool_zfs_restoreItem->setIcon( LXDG::findIcon("document-revert","") );
-}
-
-void MainUI::setupConnections(){
- connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(startEditDir(QWidget*, QWidget*)) );
- connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)) );
- connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) );
- connect(ui->menuBookmarks, SIGNAL(triggered(QAction*)), this, SLOT(goToBookmark(QAction*)) );
- connect(ui->menuExternal_Devices, SIGNAL(triggered(QAction*)), this, SLOT(goToDevice(QAction*)) );
- connect(currentDir, SIGNAL(returnPressed()), this, SLOT(goToDirectory()));
- connect(radio_view_details, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) );
- connect(radio_view_list, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) );
- connect(radio_view_icons, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) );
- connect(fsmod, SIGNAL(directoryLoaded(QString)), this, SLOT(slotStartSyncTimer()) );
- connect(syncTimer, SIGNAL(timeout()), this, SLOT(currentDirectoryLoaded()) );
- //Background worker class
- connect(this, SIGNAL(DirChanged(QString)), worker, SLOT(startDirChecks(QString)) );
- connect(worker, SIGNAL(ImagesAvailable(QStringList)), this, SLOT(AvailablePictures(QStringList)) );
- connect(worker, SIGNAL(MultimediaAvailable(QStringList)), this, SLOT(AvailableMultimediaFiles(QStringList)) );
- connect(worker, SIGNAL(SnapshotsAvailable(QString, QStringList)), this, SLOT(AvailableBackups(QString, QStringList)) );
-
- //Background worker class for statusbar
- connect(this, SIGNAL(Si_AdaptStatusBar(QFileInfoList, QString, QString, QString)), worker, SLOT(createStatusBarMsg(QFileInfoList, QString, QString, QString)) );
- connect(worker, SIGNAL(Si_DisplayStatusBar(QString)), this, SLOT(DisplayStatusBar(QString)) );
-
- //Action buttons on browser page
- connect(ui->tool_act_run, SIGNAL(clicked()), this, SLOT(OpenItem()) );
- connect(ui->tool_act_runwith, SIGNAL(clicked()), this, SLOT(OpenItemWith()) );
- connect(ui->tool_act_rm, SIGNAL(clicked()), this, SLOT(RemoveItem()) );
- connect(ui->tool_act_rename, SIGNAL(clicked()), this, SLOT(RenameItem()) );
- connect(ui->tool_act_paste, SIGNAL(clicked()), this, SLOT(PasteItems()) );
- connect(ui->tool_act_cut, SIGNAL(clicked()), this, SLOT(CutItems()) );
- connect(ui->tool_act_copy, SIGNAL(clicked()), this, SLOT(CopyItems()) );
- connect(ui->tool_act_fav, SIGNAL(clicked()), this, SLOT(FavoriteItem()) );
-
- //Tree Widget interaction
- 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()) );
-
- //Page Switching
- connect(ui->tool_goToPlayer, SIGNAL(clicked()), this, SLOT(goToMultimediaPage()) );
- connect(ui->tool_goToRestore, SIGNAL(clicked()), this, SLOT(goToRestorePage()) );
- connect(ui->tool_goToImages, SIGNAL(clicked()), this, SLOT(goToSlideshowPage()) );
- connect(ui->actionBackToBrowser, SIGNAL(triggered()), this, SLOT(goToBrowserPage()) );
-
- //Slideshow page
- connect(ui->combo_image_name, SIGNAL(currentIndexChanged(int)), this, SLOT(showNewPicture()) );
- connect(ui->tool_image_goBegin, SIGNAL(clicked()), this, SLOT(firstPicture()) );
- connect(ui->tool_image_goEnd, SIGNAL(clicked()), this, SLOT(lastPicture()) );
- connect(ui->tool_image_goNext, SIGNAL(clicked()), this, SLOT(nextPicture()) );
- connect(ui->tool_image_goPrev, SIGNAL(clicked()), this, SLOT(prevPicture()) );
- connect(ui->tool_image_remove, SIGNAL(clicked()), this, SLOT(removePicture()) );
- connect(ui->tool_image_rotateleft, SIGNAL(clicked()), this, SLOT(rotatePictureLeft()) );
- connect(ui->tool_image_rotateright, SIGNAL(clicked()), this, SLOT(rotatePictureRight()) );
-
- //ZFS Restore page
- connect(ui->slider_zfs_snapshot, SIGNAL(valueChanged(int)), this, SLOT(showSnapshot()) );
- connect(ui->tool_zfs_nextSnap, SIGNAL(clicked()), this, SLOT(nextSnapshot()) );
- connect(ui->tool_zfs_prevSnap, SIGNAL(clicked()), this, SLOT(prevSnapshot()) );
- connect(ui->tool_zfs_restoreItem, SIGNAL(clicked()), this, SLOT(restoreItems()) );
-
- //Multimedia Player page
- connect(ui->tool_player_next, SIGNAL(clicked()), this, SLOT(playerNext()));
- connect(ui->tool_player_prev, SIGNAL(clicked()), this, SLOT(playerPrevious()));
- connect(ui->tool_player_pause, SIGNAL(clicked()), this, SLOT(playerPause()));
- connect(ui->tool_player_play, SIGNAL(clicked()), this, SLOT(playerStart()));
- connect(ui->tool_player_stop, SIGNAL(clicked()), this, SLOT(playerStop()));
- connect(ui->combo_player_list, SIGNAL(currentIndexChanged(int)), this, SLOT(playerFileChanged()) );
- connect(playerSlider, SIGNAL(sliderPressed()), this, SLOT(playerSliderHeld()) );
- connect(playerSlider, SIGNAL(sliderReleased()), this, SLOT(playerSliderChanged()) );
- connect(playerSlider, SIGNAL(valueChanged(int)), this, SLOT(playerSliderMoved(int)) );
- connect(mediaObj, SIGNAL(durationChanged(qint64)), this, SLOT(playerDurationChanged(qint64)) );
- connect(mediaObj, SIGNAL(seekableChanged(bool)), playerSlider, SLOT(setEnabled(bool)) );
- connect(mediaObj, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(playerStatusChanged(QMediaPlayer::MediaStatus)) );
- connect(mediaObj, SIGNAL(positionChanged(qint64)), this, SLOT(playerTimeChanged(qint64)) );
- connect(mediaObj, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged(QMediaPlayer::State)) );
- connect(mediaObj, SIGNAL(videoAvailableChanged(bool)), this, SLOT(playerVideoAvailable(bool)) );
- connect(mediaObj, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(playerError()) );
- //Special Keyboard Shortcuts
- connect(nextTabLShort, SIGNAL(activated()), this, SLOT( prevTab() ) );
- connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) );
- connect(closeTabShort, SIGNAL(activated()), this, SLOT( tabClosed() ) );
- connect(copyFilesShort, SIGNAL(activated()), this, SLOT( CopyItems() ) );
- connect(cutFilesShort, SIGNAL(activated()), this, SLOT( CutItems() ) );
- connect(pasteFilesShort, SIGNAL(activated()), this, SLOT( PasteItems() ) );
- connect(deleteFilesShort, SIGNAL(activated()), this, SLOT( RemoveItem() ) );
-}
-
-void MainUI::loadSettings(){
- //Note: make sure this is run after all the UI elements are created and connected to slots
- // but before the first directory gets loaded
- ui->actionView_Hidden_Files->setChecked( settings->value("showhidden", false).toBool() );
- on_actionView_Hidden_Files_triggered(); //make sure to update the models too
- ui->actionShow_Action_Buttons->setChecked(settings->value("showactions", true).toBool() );
- on_actionShow_Action_Buttons_triggered(); //make sure to update the UI
- ui->actionShow_Thumbnails->setChecked( settings->value("showthumbnails", true).toBool() );
- iconProv->showthumbnails = ui->actionShow_Thumbnails->isChecked();
- QString view = settings->value("viewmode","details").toString();
- if(view=="icons"){ radio_view_icons->setChecked(true); }
- else if(view=="list"){ radio_view_list->setChecked(true); }
- else{ radio_view_details->setChecked(true); }
-}
-
-void MainUI::RebuildBookmarksMenu(){
- //Create the bookmarks menu
- ui->menuBookmarks->clear();
- ui->menuBookmarks->addAction(ui->actionManage_Bookmarks);
- ui->menuBookmarks->addSeparator();
- QStringList BM = settings->value("bookmarks", QStringList()).toStringList();
- ui->menuBookmarks->clear();
- ui->menuBookmarks->addAction(ui->actionManage_Bookmarks);
- ui->menuBookmarks->addSeparator();
- bool changed = false;
- BM.sort(); //Sort alphabetically
- for(int i=0; i<BM.length(); i++){
- if(QFile::exists(BM[i].section("::::",1,1)) ){
- QAction *act = new QAction(BM[i].section("::::",0,0),this);
- act->setWhatsThis(BM[i].section("::::",1,1));
- ui->menuBookmarks->addAction(act);
- }else{
- //Invalid directory - remove the bookmark
- BM.removeAt(i);
- i--;
- changed = true;
- }
- }
- if(changed){ settings->setValue("bookmarks",BM); }
- ui->actionManage_Bookmarks->setEnabled(BM.length()>0);
-}
-
-void MainUI::RebuildDeviceMenu(){
- //Create the External Devices Menu appropriately
- ui->menuExternal_Devices->clear();
- ui->menuExternal_Devices->addAction( ui->actionScan );
- ui->menuExternal_Devices->addSeparator();
- //Scan for externally mounted devices
- QStringList devs = LOS::ExternalDevicePaths();
- //Output Format: <type>::::<filesystem>::::<path> (6/24/14 - version 0.4.0 )
- // <type> = [USB, HDRIVE, SDCARD, DVD, LVM, UNKNOWN]
-
- //Now add them to the menu appropriately
- for(int i=0; i<devs.length(); i++){
- //Skip hidden mount points (usually only for system usage - not user browsing)
- QString label, path, fs;
- //Format inputs as necesary
- path = devs[i].section("::::",2,2);
- fs = devs[i].section("::::",1,1);
- if(path.endsWith("/") && path.length()>1 ){ path.chop(1); }
- if(path == "/"){ label = tr("Root"); }
- else{ label = path.section("/",-1).simplified(); }
- if(label.startsWith(".") ){ continue; } //don't show hidden mountpoint (not usually user-browsable)
- //Create entry for this device
- if( !fs.simplified().isEmpty()){
- //Add filesystem type to the label
- label = QString(tr("%1 (Type: %2)")).arg(label, fs);
- }
- QAction *act = new QAction(label,this);
- act->setWhatsThis(path); //full path to mountpoint
- act->setToolTip( QString(tr("Filesystem: %1")).arg( devs[i].section("::::",1,1) ) );
- //Now set the appropriate icon
- QString type = devs[i].section("::::",0,0);
- if(type=="USB"){ type = "drive-removable-media-usb"; }
- else if(type=="HDRIVE" || type=="LVM"){ type = "drive-harddisk"; }
- else if(type=="SDCARD"){ type = "media-flash-sd-mmc"; }
- else if(type=="DVD"){ type = "media-optical"; }
- else{ type = "drive-removable-media"; }
- act->setIcon( LXDG::findIcon(type, "") );
- ui->menuExternal_Devices->addAction(act);
- }
-}
-
-bool MainUI::checkUserPerms(){
- if(!isUserWritable){
- QMessageBox::warning(this, tr("Invalid Permissions"), tr("You do not have permission to edit this directory!") );
- }
- return isUserWritable;
-}
-
-QString MainUI::msToText(qint64 ms){
- QString disp;
- if(ms>3600000){
- disp.append( QString::number(ms/3600000)+":" );
- ms = ms%3600000;
- }
- if(ms>60000){
- disp.append( QString::number(ms/60000)+":" );
- ms = ms%60000;
- }else{
- disp.append("0:");
- }
- if(ms>1000){
- if(ms>=10000){ disp.append( QString::number(ms/1000) ); }
- else{ disp.append( "0"+QString::number(ms/1000) ); }
- }else{
- disp.append("00");
- }
- return disp;
-}
-
-QString MainUI::getCurrentDir(){
- return currentDir->whatsThis();
-}
-
-void MainUI::setCurrentDir(QString dir){
- if(dir.isEmpty()){ return; }
- if(syncTimer->isActive()){ syncTimer->stop(); } //already loading the info
- QFileInfo info(dir);
- QString olddir = currentDir->whatsThis();
- if(!info.isDir() || !info.exists() ){
- qDebug() << "Invalid Directory:" << dir;
- //Try to just go up the dir tree one level
- dir.chop(dir.section("/",-1).length());
- if(!QFile::exists(dir)){
- //Still bad dir - try to return to previously shown dir
- if(currentDir->whatsThis().isEmpty()){ return; } //nothing to return to
- else{ dir = currentDir->whatsThis(); }
- }
- }
- //qDebug() << "Show Directory:" << dir;
- //qDebug() << "Dir Info:" << dir;
- //qDebug() << " - RWXLOG:" << info.isReadable() << info.isWritable() << info.isExecutable() << info.isSymLink() << info.ownerId() << info.groupId();
- isUserWritable = info.isWritable();
- if(dir.endsWith("/") && dir!="/" ){ dir.chop(1); }
- QString rawdir = dir;
- //dir.replace(QDir::homePath()+"/", "~/");
- currentDir->setText(dir);
- //Update the directory viewer and update the line edit
- keepFocus = !currentDir->hasFocus();
- currentDir->setWhatsThis(dir); //save the full path internally
- fsmod->setRootPath(rawdir);
- if(radio_view_details->isChecked()){
- ui->tree_dir_view->setRootIndex(fsmod->index(dir));
- ui->tree_dir_view->selectionModel()->clearSelection();
- if(olddir.startsWith(rawdir)){
- ui->tree_dir_view->setCurrentIndex( fsmod->index(olddir));
- ui->tree_dir_view->scrollTo( fsmod->index(olddir), QAbstractItemView::PositionAtTop);
- }
- }else{
- ui->list_dir_view->setRootIndex(fsmod->index(dir));
- ui->list_dir_view->selectionModel()->clearSelection();
- if(olddir.startsWith(rawdir)){
- ui->list_dir_view->setCurrentIndex( fsmod->index(olddir));
- ui->list_dir_view->scrollTo( fsmod->index(olddir), QAbstractItemView::PositionAtTop);
- }
- }
- //Adjust the tab data
- tabBar->setTabWhatsThis( tabBar->currentIndex(), rawdir );
- if(dir!="/"){ tabBar->setTabText( tabBar->currentIndex(), dir.section("/",-1) ); }
- else{ tabBar->setTabText( tabBar->currentIndex(), dir); }
- QStringList history = tabBar->tabData(tabBar->currentIndex()).toStringList();
- if(history.isEmpty() || history.first()!=rawdir){ history.prepend(rawdir); history.removeAll(""); }
- //qDebug() << "History:" << history;
- tabBar->setTabData(tabBar->currentIndex(), history);
- //Now adjust the items as necessary
- if(rawdir != olddir){
- //The Filesystem model will need to load the new directory (triggering the background checks)
- ui->tool_goToPlayer->setVisible(false);
- ui->tool_goToRestore->setVisible(false);
- ui->tool_goToImages->setVisible(false);
- }
- //Make sure the shortcut buttons are enabled as necessary
- // If the dir is already loaded into the fsmodel cache it will not emit the directoryLoaded() signal
- /*if(rawdir == olddir){
- emit DirChanged(rawdir); //This will be automatically run when a new dir is loaded
- }
- emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), rawdir, tr("Items"));*/
- if(isUserWritable){ ui->label_dir_stats->setText(""); }
- else{ ui->label_dir_stats->setText(tr("Limited Access Directory"));
- }
-
- ui->tool_addToDir->setVisible(isUserWritable);
- ui->tool_addNewFile->setVisible(isUserWritable);
- ui->actionUpDir->setEnabled(dir!="/");
- ui->actionBack->setEnabled(history.length() > 1);
- ui->actionBookMark->setEnabled( rawdir!=QDir::homePath() && settings->value("bookmarks", QStringList()).toStringList().filter("::::"+rawdir).length()<1 );
- ItemSelectionChanged();
- RebuildDeviceMenu(); //keep this refreshed
-
-}
-
-QFileInfoList MainUI::getSelectedItems(){
- QFileInfoList out;
- if(radio_view_details->isChecked()){
- QModelIndexList items = ui->tree_dir_view->selectionModel()->selectedIndexes();
- for(int i=0; i<items.length(); i++){
- if(!out.contains(fsmod->fileInfo(items[i]))){
- out << fsmod->fileInfo(items[i]);
- }
- }
- }else{
- QModelIndexList items = ui->list_dir_view->selectionModel()->selectedIndexes();
- for(int i=0; i<items.length(); i++){
- if(!out.contains(fsmod->fileInfo(items[i]))){
- out << fsmod->fileInfo(items[i]);
- }
- }
- }
- return out;
-}
-
-/*QModelIndexList MainUI::getVisibleItems(){
- QModelIndexList out;
- if(radio_view_details->isChecked()){
- QModelIndex index = ui->tree_dir_view->indexAt(QPoint(0,0));
- while( index.isValid()){
- if(index.column()!=0){
- //move on - multiple index's per row when we only need one
- }else if(ui->tree_dir_view->viewport()->rect().contains( ui->tree_dir_view->visualRect(index) ) ){
- //index within the viewport - add it to the list
- out << index;
- }else{
- break; //index not in the viewport
- }
- index = ui->tree_dir_view->indexBelow(index); //go to the next
- if(out.contains(index)){ break; } //end of the list
- }
-
- }else{
- QModelIndex index = ui->list_dir_view->indexAt(QPoint(0,0));
- while( index.isValid()){
- if(ui->list_dir_view->viewport()->rect().contains( ui->list_dir_view->visualRect(index) ) ){
- //index within the viewport - add it to the list
- out << index;
- }else{
- break; //index not in the viewport
- }
- index = ui->list_dir_view->indexBelow(index); //go to the next
- if(out.contains(index)){ break; } //end of the list
- }
-
- }
- return out;
-}*/
-
-//==============
-// PRIVATE SLOTS
-//==============
-void MainUI::slotStartSyncTimer(){
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- if(syncTimer->isActive()){ syncTimer->stop(); }
- syncTimer->start();
-}
-
-//General button check functions
-void MainUI::AvailableMultimediaFiles(QStringList files){
- if(!files.isEmpty()){
- ui->combo_player_list->clear();
- ui->combo_player_list->addItems(files);
- ui->tool_goToPlayer->setVisible(true);
- }else{
- ui->tool_goToPlayer->setVisible(false);
- }
-
-}
-
-void MainUI::AvailableBackups(QString basedir, QStringList snapdirs){
- snapmod->setRootPath(basedir); //set the base snapshot dir as the new root
- snapDirs = snapdirs;
-
- //Now enable the button if any snapshots available
- ui->tool_goToRestore->setVisible(!snapDirs.isEmpty());
-}
-
-void MainUI::DisplayStatusBar(QString msg){
- //qDebug() << "message to show in the status bar:" << msg;
- ui->statusbar->showMessage(msg);
-}
-
-void MainUI::AvailablePictures(QStringList pics){
- if(!pics.isEmpty()){
- QString citem = ui->combo_image_name->currentText();
- ui->combo_image_name->clear();
- ui->combo_image_name->addItems(pics);
- if(pics.contains(citem)){
- ui->combo_image_name->setCurrentText(citem);
- }
- ui->tool_goToImages->setVisible(true);
- }
-
-}
-
-//-----------------------------------
-//General page switching
-//-----------------------------------
-void MainUI::goToMultimediaPage(){
- //Make toolbar items disappear appropriately
- ui->actionBackToBrowser->setVisible(true);
- ui->actionBack->setVisible(false);
- ui->actionUpDir->setVisible(false);
- ui->actionHome->setVisible(false);
- ui->actionBookMark->setVisible(false);
- currentDir->setEnabled(false);
- //Disable all the UI elements specifically for the Browser side of things
- ui->actionNew_Tab->setEnabled(false);
- ui->menuView->setEnabled(false);
- ui->menuBookmarks->setEnabled(false);
- ui->menuExternal_Devices->setEnabled(false);
- //Start the player on the first selected item
- QFileInfoList sel = getSelectedItems();
- if(!sel.isEmpty()){
- QStringList names;
- for(int i=0; i<sel.length(); i++){ names << sel[i].fileName(); }
- //start the slideshow on the first selected picture
- for(int i=0; i<ui->combo_player_list->count(); i++){
- if(names.contains( ui->combo_player_list->itemText(i) )){ ui->combo_player_list->setCurrentIndex(i); break; }
- }
- }
- //Now go to the Multimedia player
- ui->label_player_novideo->setText(tr("Click Play to Start"));
- ui->stackedWidget->setCurrentWidget(ui->page_audioPlayer);
-}
-
-void MainUI::goToRestorePage(){
- //Make toolbar items disappear appropriately
- ui->actionBackToBrowser->setVisible(true);
- ui->actionBack->setVisible(false);
- ui->actionUpDir->setVisible(false);
- ui->actionHome->setVisible(false);
- ui->actionBookMark->setVisible(false);
- currentDir->setEnabled(false);
- //Disable all the UI elements specifically for the Browser side of things
- ui->actionNew_Tab->setEnabled(false);
- ui->menuView->setEnabled(false);
- ui->menuBookmarks->setEnabled(false);
- ui->menuExternal_Devices->setEnabled(false);
- //Load all the info into the file restore page
- ui->slider_zfs_snapshot->setRange(1,snapDirs.length());
- ui->slider_zfs_snapshot->setValue(snapDirs.length());
- //Now go to the file restore page
- showSnapshot(); //Make sure it is updated for the current directory
- ui->stackedWidget->setCurrentWidget(ui->page_zfs);
-}
-
-void MainUI::goToSlideshowPage(){
- //Make toolbar items disappear appropriately
- ui->actionBackToBrowser->setVisible(true);
- ui->actionBack->setVisible(false);
- ui->actionUpDir->setVisible(false);
- ui->actionHome->setVisible(false);
- ui->actionBookMark->setVisible(false);
- currentDir->setEnabled(false);
- //Disable all the UI elements specifically for the Browser side of things
- ui->actionNew_Tab->setEnabled(false);
- ui->menuView->setEnabled(false);
- ui->menuBookmarks->setEnabled(false);
- ui->menuExternal_Devices->setEnabled(false);
- QFileInfoList sel = getSelectedItems();
- if(!sel.isEmpty()){
- QStringList names;
- for(int i=0; i<sel.length(); i++){ names << sel[i].fileName(); }
- //start the slideshow on the first selected picture
- for(int i=0; i<ui->combo_image_name->count(); i++){
- if(names.contains( ui->combo_image_name->itemText(i) )){ ui->combo_image_name->setCurrentIndex(i); break; }
- }
- }
- //Now go to the Slideshow player
- ui->stackedWidget->setCurrentWidget(ui->page_image_view);
- showNewPicture(); //make sure it is up to date with the widget size
-}
-
-void MainUI::goToBrowserPage(){
- //Make toolbar items re-appear appropriately
- ui->actionBackToBrowser->setVisible(false);
- ui->actionBack->setVisible(true);
- ui->actionUpDir->setVisible(true);
- ui->actionHome->setVisible(true);
- ui->actionBookMark->setVisible(true);
- currentDir->setEnabled(true);
- //Disable all the UI elements specifically for the Browser side of things
- ui->actionNew_Tab->setEnabled(true);
- ui->menuView->setEnabled(true);
- ui->menuBookmarks->setEnabled(true);
- ui->menuExternal_Devices->setEnabled(true);
- //Now go to the browser
- if(ui->stackedWidget->currentWidget()==ui->page_audioPlayer){ mediaObj->stop(); }
- ui->stackedWidget->setCurrentWidget(ui->page_browser);
- reloadDirectory();
-}
-
-//---------------------
-//Menu Actions
-//---------------------
-void MainUI::on_actionNew_Tab_triggered(){
- OpenDirs(QStringList() << QDir::homePath());
- //Now go to that tab (always last)
- tabBar->setCurrentIndex(tabBar->count()-1);
-}
-
-void MainUI::on_actionSearch_triggered(){
- QProcess::startDetached("lumina-search -dir \""+getCurrentDir()+"\"");
-}
-
-void MainUI::on_actionClose_triggered(){
- if(tabBar->count() > 1){
- if(QMessageBox::Yes != QMessageBox::question(this, tr("Verify Quit"), tr("You have multiple tabs open. Are you sure you want to quit?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes ) ){
- return;
- }
- }
- qDebug() << "Closing Down...";
- this->close();
-}
-
-void MainUI::on_actionView_Hidden_Files_triggered(){
- if(ui->actionView_Hidden_Files->isChecked()){
- fsmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden );
- snapmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden );
- }else{
- fsmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs );
- snapmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs );
- }
- //Now save this setting for later
- settings->setValue("showhidden", ui->actionView_Hidden_Files->isChecked());
- //Re-load the view widget
- setCurrentDir(getCurrentDir());
-}
-
-void MainUI::on_actionShow_Action_Buttons_triggered(){
- ui->group_actions->setVisible(ui->actionShow_Action_Buttons->isChecked());
- settings->setValue("showactions", ui->actionShow_Action_Buttons->isChecked());
-}
-
-void MainUI::on_actionShow_Thumbnails_triggered(){
- //Now save this setting for later
- settings->setValue("showthumbnails", ui->actionShow_Thumbnails->isChecked());
- //Set the value in the icon provider
- iconProv->showthumbnails = ui->actionShow_Thumbnails->isChecked();
- //Now make sure the filesystem model knows to re-load the image data
- fsmod->revert();
- //Re-load the view widget
- setCurrentDir(getCurrentDir());
-}
-
-void MainUI::goToBookmark(QAction *act){
- if(act==ui->actionManage_Bookmarks){
- BMMDialog dlg(this);
- dlg.loadSettings(settings);
- dlg.exec();
- RebuildBookmarksMenu();
- }else{
- setCurrentDir(act->whatsThis());
- }
-}
-
-void MainUI::goToDevice(QAction *act){
- if(act==ui->actionScan){
- RebuildDeviceMenu();
- }else{
- setCurrentDir(act->whatsThis());
- }
-}
-
-void MainUI::viewModeChanged(bool active){
- if(!active){ return; } //on every view change, all 3 radio buttons will call this function - only run this once though
- if(radio_view_details->isChecked()){
- ui->tree_dir_view->setVisible(true);
- ui->list_dir_view->setVisible(false);
- settings->setValue("viewmode","details");
- }else if(radio_view_list->isChecked()){
- ui->tree_dir_view->setVisible(false);
- ui->list_dir_view->setVisible(true);
- ui->list_dir_view->setViewMode( QListView::ListMode );
- ui->list_dir_view->setUniformItemSizes(false);
- ui->list_dir_view->setIconSize( QSize(20,20) );
- settings->setValue("viewmode","list");
- }else{ //icons
- ui->tree_dir_view->setVisible(false);
- ui->list_dir_view->setVisible(true);
- ui->list_dir_view->setViewMode( QListView::IconMode );
- ui->list_dir_view->setUniformItemSizes(true);
- ui->list_dir_view->setIconSize( QSize(90,64) );
- settings->setValue("viewmode","icons");
- }
- //Re-load the view widget
- setCurrentDir(getCurrentDir());
-
-}
-
-//-----------------------
-//Toolbar Actions
-//-----------------------
-void MainUI::on_actionBack_triggered(){
- QStringList history = tabBar->tabData(tabBar->currentIndex()).toStringList();
- if(history.length() <= 1){ return; } //need the second item
- history.removeAt(0); //remove the first item (the current dir)
- tabBar->setTabData(tabBar->currentIndex(), history); //re-write the saved history
- setCurrentDir(history.first()); //go to the previous entry in the history
-}
-
-void MainUI::on_actionUpDir_triggered(){
- QString dir = getCurrentDir();
- dir.chop( dir.section("/",-1).length() );
- setCurrentDir(dir);
-}
-
-void MainUI::on_actionHome_triggered(){
- setCurrentDir(QDir::homePath());
-}
-
-void MainUI::on_actionBookMark_triggered(){
- QString dir = getCurrentDir();
- bool ok = false;
- QString name = QInputDialog::getText(this, tr("New Bookmark"), tr("Name:"), QLineEdit::Normal, dir, \
- &ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly);
- if(!ok || name.isEmpty()){ return; } //cancelled
- QStringList BM = settings->value("bookmarks",QStringList()).toStringList();
- if(BM.filter(name+"::::").length() >0){
- QMessageBox::warning(this, tr("Invalid Name"), tr("This bookmark name already exists. Please choose another.") );
- QTimer::singleShot(0,this, SLOT(on_actionBookMark_triggered()));
- return;
- }
- BM.append(name+"::::"+dir);
- BM.sort(); //sort alphabetically by name
- settings->setValue("bookmarks", BM);
- //Now rebuild the bookmarks menu
- RebuildBookmarksMenu();
- ui->actionBookMark->setEnabled(false); //already bookmarked
-}
-
-//-----------------------------
-//Browser Functions
-//-----------------------------
-void MainUI::startEditDir(QWidget *old, QWidget *now){
- if(now==currentDir){
- //The dir edit just got focus
- QString dir = currentDir->text();
- dir.replace("~/", QDir::homePath()+"/");
- currentDir->setText(dir);
- //Try to move to the end
- currentDir->selectAll();
- }else if(old==currentDir){
- QString dir = currentDir->text();
- setCurrentDir(dir);
- }
-}
-
-void MainUI::goToDirectory(){
- QString dir = currentDir->text();
- dir.replace("~/",QDir::homePath()+"/");
- setCurrentDir(dir);
-}
-
-void MainUI::reloadDirectory(){
- setCurrentDir( getCurrentDir() );
-}
-
-/*void MainUI::viewportChanged(){
- if( !ui->actionsShow_Thumbnails->isChecked()){ return; }
- QModelIndexList list = getVisibleItems();
- for(int i=0; i<list.length(); i++){
- if( !ui->actionsShow_Thumbnails->isChecked()){ return; } //break out as necessary
- if( imgFilter.contains("*."+fsmod->filePath(list[i]).section("/",-1).section(".",-1).toLower()){
- fmod->
- }
- }
-}*/
-
-void MainUI::currentDirectoryLoaded(){
- //The directory was just loaded: refresh the action buttons as neccesary
- // NOTE: This is only "caught" when a *new* directory is loaded into the model
- ui->tool_goToPlayer->setVisible(false);
- ui->tool_goToRestore->setVisible(false);
- ui->tool_goToImages->setVisible(false);
- emit DirChanged(getCurrentDir());
- emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Folders"), tr("Files"));
- ItemSelectionChanged();
-}
-
-void MainUI::on_tool_addToDir_clicked(){
- bool ok = false;
- QString newdir = QInputDialog::getText(this, tr("New Directory"), tr("Name:"), QLineEdit::Normal, "", \
- &ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly);
- if(!ok || newdir.isEmpty()){ return; }
- QString full = getCurrentDir();
- if(!full.endsWith("/")){ full.append("/"); }
- QDir dir(full); //open the current dir
- full.append(newdir); //append the new name to the current dir
- //Verify that the new dir does not already exist
- if(dir.exists(full)){
- QMessageBox::warning(this, tr("Invalid Name"), tr("A file or directory with that name already exists! Please pick a different name."));
- QTimer::singleShot(0,this, SLOT(on_tool_addToDir_clicked()) ); //repeat this function
- }else{
- if(!dir.mkdir(newdir) ){
- QMessageBox::warning(this, tr("Error Creating Directory"), tr("The directory could not be created. Please ensure that you have the proper permissions to modify the current directory."));
- }
- }
-}
-
-void MainUI::on_tool_addNewFile_clicked(){
- bool ok = false;
- QString newdocument = QInputDialog::getText(this, tr("New Document"), tr("Name:"), QLineEdit::Normal, "", \
- &ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly);
- if(!ok || newdocument.isEmpty()){ return; }
- QString full = getCurrentDir();
- if(!full.endsWith("/")){ full.append("/"); }
- QFile file(full+newdocument);
- if(file.open(QIODevice::ReadWrite)){
- //If successfully opened, it has created a blank file
- file.close();
- }else{
- QMessageBox::warning(this, tr("Error Creating Document"), tr("The document could not be created. Please ensure that you have the proper permissions."));
- }
-
-}
-
-void MainUI::tabChanged(int tab){
- //Load the directory contained in the new tab
- qDebug() << "Change to Tab:" << tab << tabBar->tabText(tab);
- QString dir = tabBar->tabWhatsThis(tab); //get the full directory
- setCurrentDir(dir); //display this as the current dir
-}
-
-void MainUI::tabClosed(int tab){
- if(tabBar->count()==1){ return; } //Can't close the only tab
- if(tab < 0){ tab = tabBar->currentIndex(); }
- //Remove the tab (will automatically move to a different one);
- qDebug() << "Closing tab:" << tab << tabBar->tabText(tab);
- tabBar->removeTab(tab);
- tabBar->setVisible( tabBar->count() > 1 );
-}
-
-void MainUI::prevTab(){
- int cur = tabBar->currentIndex();
- if(cur == 0){ tabBar->setCurrentIndex( tabBar->count()-1 ); }
- else{ tabBar->setCurrentIndex( cur-1 ); }
-}
-
-void MainUI::nextTab(){
- int cur = tabBar->currentIndex();
- if(cur == (tabBar->count()-1) ){ tabBar->setCurrentIndex(0); }
- else{ tabBar->setCurrentIndex( cur+1 ); }
-}
-
-void MainUI::ItemRun(const QModelIndex &index){
- //This is called when the user double clicks a file/directory
- QString val = fsmod->filePath(index).section("/",-1);
- QString itemPath = getCurrentDir();
- if( !itemPath.endsWith("/")){ itemPath.append("/"); }
- itemPath.append(val);
- if(fsmod->isDir(index)){
- setCurrentDir( itemPath );
- }else{
- //Must be a file, try to run it
- QProcess::startDetached("lumina-open \""+itemPath+"\"");
- }
-}
-
-void MainUI::OpenContextMenu(const QPoint &pt){
- QFileInfo info;
- if(radio_view_details->isChecked()){
- QModelIndex it = ui->tree_dir_view->indexAt(pt);
- if(!it.isValid()){ CItem.clear();}
- else{
- info = fsmod->fileInfo(it);
- CItem = info.absoluteFilePath();
- }
- }else{
- QModelIndex it = ui->list_dir_view->indexAt(pt);
- if(!it.isValid()){ CItem.clear();}
- else{
- info = fsmod->fileInfo(it);
- CItem = info.absoluteFilePath();
- }
- }
- //Create the context menu
- contextMenu->clear();
- if(!CItem.isEmpty()){
- contextMenu->addAction(LXDG::findIcon("run-build-file",""), tr("Open"), this, SLOT(OpenItem()) );
- contextMenu->addAction(LXDG::findIcon("run-build-configure",""), tr("Open With..."), this, SLOT(OpenItemWith()) );
-
- contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename"), this, SLOT(RenameItem()) )->setEnabled(info.isWritable());
- contextMenu->addAction(LXDG::findIcon("document-encrypted",""), tr("View Checksums"), this, SLOT(ChecksumItems()) );
- contextMenu->addSeparator();
- }
- bool hasSelection = !getSelectedItems().isEmpty();
- //Now add the general selection options
- contextMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(CutItems()) )->setEnabled(info.isWritable() && hasSelection);
- contextMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(CopyItems()) )->setEnabled(hasSelection);
- contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(PasteItems()) )->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && isUserWritable);
- contextMenu->addSeparator();
- contextMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(RemoveItem()) )->setEnabled(info.isWritable()&&hasSelection);
- if(LUtils::isValidBinary("lumina-fileinfo")){
- contextMenu->addSeparator();
- contextMenu->addAction(LXDG::findIcon("edit-find-replace",""), tr("File Properties"), this, SLOT(ViewPropertiesItem()) )->setEnabled(hasSelection);
- }
- if (info.isDir() || CItem.isEmpty()) {
- //in case the user click on a directory or click on the background
- contextMenu->addSeparator();
- contextMenu->addAction(LXDG::findIcon("system-search",""), tr("Open Terminal here"), this, SLOT(openTerminal()));
- }
- //Now show the menu
- if(radio_view_details->isChecked()){
- contextMenu->popup(ui->tree_dir_view->mapToGlobal(pt));
- }else{
- contextMenu->popup(ui->list_dir_view->mapToGlobal(pt));
- }
-}
-
-void MainUI::ItemSelectionChanged(){
- //Enable/disable the action buttons
- QFileInfoList sel = getSelectedItems();
- //display info related to files selected.
- //TO CHECK: impact if filesystem is very slow
- if(sel.size()>0){ emit Si_AdaptStatusBar(sel, "", tr("Selected Folders"), tr("Files"));}
- else{ emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Folders"), tr("Files")); }
-
- ui->tool_act_run->setEnabled(!sel.isEmpty());
- ui->tool_act_runwith->setEnabled(!sel.isEmpty());
- ui->tool_act_rm->setEnabled(!sel.isEmpty() && isUserWritable);
- ui->tool_act_rename->setEnabled(sel.length()==1 && isUserWritable);
- ui->tool_act_cut->setEnabled(!sel.isEmpty() && isUserWritable);
- ui->tool_act_copy->setEnabled(!sel.isEmpty());
- ui->tool_act_paste->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && isUserWritable);
- if(ui->tool_act_paste->isEnabled()){
- ui->tool_act_paste->setToolTip( QString(tr("Currently on clipboard:\n%1")).arg( QString(QApplication::clipboard()->mimeData()->data("x-special/lumina-copied-files")).replace("::::",": ") ) );
- }else{
- ui->tool_act_paste->setToolTip("");
- }
- QString itname;
- if(sel.length()==1){ itname = sel[0].fileName(); }
- bool ok = !itname.isEmpty() && (getCurrentDir()!=QDir::homePath()+"/Desktop");
- if(ok){
- ok = !LUtils::isFavorite(sel[0].canonicalFilePath());
- }
- ui->tool_act_fav->setEnabled(ok);
-}
-
-//-------------------------------
-//Slideshow Functions
-//-------------------------------
-void MainUI::showNewPicture(){
- if( !ui->label_image->isVisible() ){ return; } //don't update if not visible - can cause strange resizing issues
- QString file = getCurrentDir();
- if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());
- //qDebug() << "Show Image:" << file;
- QPixmap pix(file);
- if(pix.size().width() > ui->label_image->contentsRect().width() || pix.size().height() > ui->label_image->contentsRect().height()){
- pix = pix.scaled(ui->label_image->contentsRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
- }
- ui->label_image->setPixmap(pix);
- //Now set/load the buttons
- ui->tool_image_goBegin->setEnabled(ui->combo_image_name->currentIndex()>0);
- ui->tool_image_goPrev->setEnabled(ui->combo_image_name->currentIndex()>0);
- ui->tool_image_goEnd->setEnabled(ui->combo_image_name->currentIndex()<(ui->combo_image_name->count()-1));
- ui->tool_image_goNext->setEnabled(ui->combo_image_name->currentIndex()<(ui->combo_image_name->count()-1));
- ui->label_image_index->setText( QString::number(ui->combo_image_name->currentIndex()+1)+"/"+QString::number(ui->combo_image_name->count()) );
- static QList<QByteArray> writeableformats;
- if(writeableformats.isEmpty()){
- writeableformats = QImageWriter::supportedImageFormats();
- qDebug() << "Writeable image formats:" << writeableformats;
- }
- bool canwrite = writeableformats.contains(file.section(".",-1).toLower().toLocal8Bit()); //compare the suffix with the list
- ui->tool_image_remove->setEnabled(isUserWritable);
- ui->tool_image_rotateleft->setEnabled(isUserWritable && canwrite);
- ui->tool_image_rotateright->setEnabled(isUserWritable && canwrite);
-}
-
-void MainUI::firstPicture(){
- ui->combo_image_name->setCurrentIndex(0);
-}
-
-void MainUI::prevPicture(){
- ui->combo_image_name->setCurrentIndex( ui->combo_image_name->currentIndex()-1 );
-}
-
-void MainUI::nextPicture(){
- ui->combo_image_name->setCurrentIndex( ui->combo_image_name->currentIndex()+1 );
-}
-
-void MainUI::lastPicture(){
- ui->combo_image_name->setCurrentIndex( ui->combo_image_name->count()-1 );
-}
-
-void MainUI::removePicture(){
- QString file = getCurrentDir();
- if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());
- //Verify permanent removal of file/dir
- if(QMessageBox::Yes != QMessageBox::question(this, tr("Verify Removal"), tr("WARNING: This will permanently delete the file from the system!")+"\n"+tr("Are you sure you want to continue?")+"\n\n"+file, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
- return; //cancelled
- }
- if( QFile::remove(file) ){
- int index = ui->combo_image_name->currentIndex();
- ui->combo_image_name->removeItem( index );
- }
-}
-
-void MainUI::rotatePictureLeft(){
- //First load the file fresh (not the scaled version in the UI)
- QString file = getCurrentDir();
- if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());
- QPixmap pix(file);
- //Now rotate the image 90 degrees counter-clockwise
- QTransform trans;
- pix = pix.transformed( trans.rotate(-90) , Qt::SmoothTransformation);
- //Now save the image back to the same file
- pix.save(file);
- //Now re-load the image in the UI
- showNewPicture();
-}
-
-void MainUI::rotatePictureRight(){
- //First load the file fresh (not the scaled version in the UI)
- QString file = getCurrentDir();
- if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());
- QPixmap pix(file);
- //Now rotate the image 90 degrees counter-clockwise
- QTransform trans;
- pix = pix.transformed( trans.rotate(90) , Qt::SmoothTransformation);
- //Now save the image back to the same file
- pix.save(file);
- //Now re-load the image in the UI
- showNewPicture();
-}
-
-//----------------------------------
-//ZFS Restore Functions
-//----------------------------------
-void MainUI::snapshotLoaded(){
- ui->tree_zfs_dir->resizeColumnToContents(0);
-}
-
-void MainUI::showSnapshot(){
- ui->tool_zfs_prevSnap->setEnabled(ui->slider_zfs_snapshot->value()!=1);
- ui->tool_zfs_nextSnap->setEnabled(ui->slider_zfs_snapshot->value()!=ui->slider_zfs_snapshot->maximum());
- ui->label_zfs_snap->setText( snapDirs[ui->slider_zfs_snapshot->value()-1].section("/.zfs/snapshot/",1,1).section("/",0,0) );
- //Load the dir contents
- ui->tree_zfs_dir->setRootIndex(snapmod->index(snapDirs[ui->slider_zfs_snapshot->value()-1]));
-}
-
-void MainUI::prevSnapshot(){
- ui->slider_zfs_snapshot->setValue(ui->slider_zfs_snapshot->value()-1);
-}
-
-void MainUI::nextSnapshot(){
- ui->slider_zfs_snapshot->setValue(ui->slider_zfs_snapshot->value()+1);
-}
-
-void MainUI::restoreItems(){
- //Get the selected items
- QStringList sel; //= getSelectedItems();
- QModelIndexList items = ui->tree_zfs_dir->selectionModel()->selectedIndexes();
- for(int i=0; i<items.length(); i++){
- sel << snapmod->filePath(items[i]).section("/",-1);
- }
- sel.removeDuplicates();
- if(sel.isEmpty()){ return; } //nothing selected
- if(!checkUserPerms()){ return; }
- //Get the directories
- QString snapdir = snapDirs[ui->slider_zfs_snapshot->value()-1];
- QString basedir = getCurrentDir();
- if(!basedir.endsWith("/")){ basedir.append("/"); }
- if(!snapdir.endsWith("/")){ snapdir.append("/"); }
- //Fill out the lists appropriately
- QStringList resto;
- qDebug() << "Items Selected:" << sel;
- for(int i=0; i<sel.length(); i++){
- resto << basedir+sel[i];
- sel[i] = snapdir+sel[i];
- }
- qDebug() << "Restore Items:" << sel << "\n" << resto;
- //Restore the items
- FODialog dlg(this);
- dlg.setOverwrite(ui->check_zfs_overwrite->isChecked());
- dlg.RestoreFiles(sel, resto);
- dlg.exec();
- if(dlg.noerrors){
- QMessageBox::information(this, tr("Success"), tr("Successfully restored selection") );
- }
-}
-
-//----------------------------
-// Multimedia Player
-//----------------------------
-void MainUI::playerStart(){
- if(ui->stackedWidget->currentWidget()!=ui->page_audioPlayer){ return; } //don't play if not in the player
-
- if(mediaObj->state()==QMediaPlayer::PausedState \
- && mediaObj->currentMedia().canonicalUrl().fileName()==ui->combo_player_list->currentText() ){
- mediaObj->play();
- }else{
- mediaObj->stop();
- //Get the selected file path
- QString filePath = getCurrentDir();
- if(!filePath.endsWith("/")){ filePath.append("/"); }
- filePath.append( ui->combo_player_list->currentText() );
- mediaObj->setMedia( QUrl::fromLocalFile(filePath) );
- playerTTime.clear();
- playerSlider->setEnabled(mediaObj->isSeekable());
- mediaObj->play();
- }
-}
-
-void MainUI::playerError(){
- QString msg = QString(tr("Error Playing File: %1"));
- msg = msg.arg( mediaObj->currentMedia().canonicalUrl().fileName() );
- msg.append("\n"+mediaObj->errorString());
- ui->label_player_novideo->setText(msg);
-}
-
-void MainUI::playerStop(){
- mediaObj->stop();
-}
-
-void MainUI::playerPause(){
- mediaObj->pause();
-}
-
-void MainUI::playerNext(){
- ui->combo_player_list->setCurrentIndex( ui->combo_player_list->currentIndex()+1);
- if(mediaObj->state()!=QMediaPlayer::StoppedState){ playerStart(); }
-}
-
-void MainUI::playerPrevious(){
- ui->combo_player_list->setCurrentIndex( ui->combo_player_list->currentIndex()-1);
- if(mediaObj->state()!=QMediaPlayer::StoppedState){ playerStart(); }
-}
-
-void MainUI::playerFinished(){
- if(ui->combo_player_list->currentIndex()<(ui->combo_player_list->count()-1) && ui->check_player_gotonext->isChecked()){
- ui->combo_player_list->setCurrentIndex( ui->combo_player_list->currentIndex()+1 );
- QTimer::singleShot(0,this,SLOT(playerStart()));
- }else{
- ui->label_player_novideo->setText(tr("Finished"));
- }
-}
-
-void MainUI::playerStatusChanged(QMediaPlayer::MediaStatus stat){
- //Only use this for end-of-file detection - use the state detection otherwise
- if(stat == QMediaPlayer::EndOfMedia){
- if(!mediaObj->isMuted()){ playerFinished(); } //make sure it is not being seeked right now
- }
-}
-
-void MainUI::playerStateChanged(QMediaPlayer::State newstate){
- //This function keeps track of updating the visuals of the player
- bool running = false;
- bool showVideo = false;
- QString msg;
- switch(newstate){
- case QMediaPlayer::PlayingState:
- running=true;
- showVideo = mediaObj->isVideoAvailable();
- msg = "";//mediaObj->metaData(Phonon::TitleMetaData).join(" ");
- if(msg.simplified().isEmpty()){ msg = ui->combo_player_list->currentText(); }
- ui->label_player_novideo->setText(tr("Playing:")+"\n"+msg);
- break;
- case QMediaPlayer::PausedState:
- showVideo=videoDisplay->isVisible(); //don't change the screen
- break;
- case QMediaPlayer::StoppedState:
- ui->label_player_novideo->setText(tr("Stopped"));
- break;
- }
- ui->tool_player_play->setVisible(!running);
- ui->tool_player_pause->setVisible(running);
- ui->tool_player_stop->setEnabled(running);
- ui->label_player_novideo->setVisible(!showVideo);
- videoDisplay->setVisible(showVideo);
-}
-
-void MainUI::playerVideoAvailable(bool showVideo){
- ui->label_player_novideo->setVisible(!showVideo);
- videoDisplay->setVisible(showVideo);
-}
-
-void MainUI::playerDurationChanged(qint64 dur){
- if(dur < 0){ return; } //not ready yet
- playerSlider->setMaximum(mediaObj->duration());
- playerTTime = msToText(dur);
-}
-
-void MainUI::playerTimeChanged(qint64 ctime){
- if(mediaObj->isMuted() || playerTTime.isEmpty() ){ return; } //currently being moved
- playerSlider->setSliderPosition(ctime);
-}
-
-void MainUI::playerSliderMoved(int val){
- ui->label_player_runstats->setText( msToText(val)+"/"+playerTTime );
- if(mediaObj->isMuted()){ mediaObj->setPosition(playerSlider->value()); } //currently seeking
-}
-
-void MainUI::playerSliderHeld(){
- mediaObj->setMuted(true);
- mediaObj->pause();
-}
-void MainUI::playerSliderChanged(){
- if(mediaObj->state()==QMediaPlayer::PausedState){ mediaObj->play(); }
- mediaObj->setMuted(false);
-}
-
-void MainUI::playerFileChanged(){
- ui->tool_player_next->setEnabled( ui->combo_player_list->count() > (ui->combo_player_list->currentIndex()+1) );
- ui->tool_player_prev->setEnabled( (ui->combo_player_list->currentIndex()-1) >= 0 );
-}
-
-//----------------------------------
-// Context Menu Actions
-//----------------------------------
-void MainUI::OpenItem(){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
-
- QStringList dirs;
- for(int i=0; i<sel.length(); i++){
- if(sel[i].isDir()){ dirs << sel[i].absoluteFilePath(); }
- else{
- qDebug() << "Opening File:" << sel[i].absoluteFilePath();
- QProcess::startDetached("lumina-open \""+sel[i].absoluteFilePath()+"\"");
- }
- }
- if(!dirs.isEmpty()){ OpenDirs(dirs); }
- CItem.clear();
-}
-
-void MainUI::OpenItemWith(){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){
- qDebug() << "Opening File With:" << sel[i].absoluteFilePath();
- QProcess::startDetached("lumina-open -select \""+sel[i].absoluteFilePath()+"\"");
- }
- CItem.clear();
-}
-
-/*void MainUI::OpenDir(){
- if(CItem.isEmpty()){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- else{ CItem = sel[0].absoluteFilePath(); }
- }
- OpenDirs(QStringList() << CItem);
- CItem.clear();
-}*/
-
-void MainUI::RemoveItem(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- if(!checkUserPerms()){ return; }
- //Get the selected items
- QStringList paths, names;
- //if(CItem.isEmpty()){
- QFileInfoList sel = getSelectedItems();
- for(int i=0; i<sel.length(); i++){
- paths << sel[i].absoluteFilePath();
- names << sel[i].fileName();
- }
- if(sel.isEmpty()){ return; } //nothing selected
- /*}else{
- paths << CItem;
- names << CItem.section("/",-1);
- }*/
- //Verify permanent removal of file/dir
- if(QMessageBox::Yes != QMessageBox::question(this, tr("Verify Removal"), tr("WARNING: This will permanently delete the file(s) from the system!")+"\n"+tr("Are you sure you want to continue?")+"\n\n"+names.join("\n"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
- return; //cancelled
- }
- //Now remove the file/dir
- qDebug() << "Delete: "<<paths;
- FODialog dlg(this);
- dlg.RemoveFiles(paths);
- dlg.show();
- dlg.exec();
- CItem.clear();
-}
-
-void MainUI::RenameItem(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- if(!checkUserPerms()){ return; }
- if(CItem.isEmpty()){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- else{ CItem = sel[0].absoluteFilePath(); }
- }
- QString fname = CItem;
- QString path = fname;
- fname = fname.section("/",-1); //turn this into just the file name
- path.chop(fname.length()); //turn this into the base directory path (has a "/" at the end)
- //Now prompt for the new filename
- bool ok = false;
- QString nname = QInputDialog::getText(this, tr("Rename File"),tr("New Name:"), QLineEdit::Normal, fname, &ok);
- if(!ok || nname.isEmpty()){ CItem.clear(); return; } //cancelled
- //Now check for a file extension and add it if necessary
- QString oext = fname.section(".",-1);
- if("."+oext == fname){ oext.clear(); } //hidden file without an extension
- else if(oext==fname){ oext.clear(); } //no extension
- QString next = nname.section(".",-1);
- if(next==nname){ next.clear(); } //no extension
- if(next.isEmpty() && !oext.isEmpty()){
- nname.append( "."+oext );
- }
- //Check if this filename already exists
- bool overwrite = QFile::exists(path+nname);
- if(overwrite){
- if(QMessageBox::Yes != QMessageBox::question(this, tr("Overwrite File?"), tr("An existing file with the same name will be replaced. Are you sure you want to proceed?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
- CItem.clear(); return; //cancelled
- }
- }
- //Now perform the move
- qDebug() << "Rename:" << path+fname << "->" << path+nname;
- FODialog dlg(this);
- dlg.setOverwrite(overwrite);
- dlg.MoveFiles(QStringList() << path+fname, QStringList() << path+nname);
- dlg.show();
- dlg.exec();
- CItem.clear();
-
- ItemSelectionChanged();
-}
-
-void MainUI::FavoriteItem(){
- if(CItem.isEmpty()){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- else{ CItem = sel[0].canonicalFilePath(); }
- }
- //QString fname = CItem;
- QString fullpath = CItem;
- /*fname = fname.section("/",-1); //turn this into just the file name
- if(QFile::exists(favdir+fname)){ QFile::remove(favdir+fname); } //remove the stale link
- QFile::link(fullpath, favdir+fname);*/
- LUtils::addFavorite(fullpath);
- CItem.clear();
- ItemSelectionChanged();
-}
-
-void MainUI::ViewPropertiesItem(){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){
- QProcess::startDetached("lumina-fileinfo \""+sel[i].absoluteFilePath()+"\"");
- }
-}
-
-void MainUI::openTerminal(){
- QFileInfoList sel = getSelectedItems();
- QString shell;
- //we get the shell has defined in the environment
- if (getenv("SHELL")) shell = QString(getenv("SHELL"));
- else shell = QString("/bin/sh");
- //we use the application defined as thate default terminal
- QSettings *sessionsettings = new QSettings( QSettings::UserScope, "LuminaDE","sessionsettings", this);
- //xterm remains the default
- QString defTerminal = sessionsettings->value("default-terminal", "xterm").toString();
- if(defTerminal.endsWith(".desktop")){
- //Pull the binary name out of the shortcut
- bool ok = false;
- XDGDesktop DF = LXDG::loadDesktopFile(defTerminal,ok);
- if(!ok){ defTerminal = "xterm"; }
- else{ defTerminal = DF.exec.section(" ",0,0); } //only take the binary name - not any other flags
- }
- if( !LUtils::isValidBinary(defTerminal) ){
- //The binary does not exist or is invalid
- defTerminal = "xterm";
- }
- if(sel.isEmpty()){
- //-e is the parameter for most of the terminal appliction to execute an external command.
- //In your case we start a shell in the selected directory
- QProcess::startDetached(defTerminal + " -e \"cd " + getCurrentDir() + " && " + shell + " \" ");
- } else {
- QProcess::startDetached(defTerminal + " -e \"cd " + sel[0].absoluteFilePath() + " && " + shell + " \" ");
- }
-}
-
-
-void MainUI::CutItems(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- if(!checkUserPerms()){ return; }
- //Get all the selected Items
- QFileInfoList sel = getSelectedItems();
- QStringList items;
- if(sel.isEmpty()){ return; } //nothing selected
- //Format the data string
- for(int i=0; i<sel.length(); i++){
- items << "cut::::"+sel[i].absoluteFilePath();
- //sel[i] = sel[i].prepend("cut::::");
- }
-
- //Now save that data to the global clipboard
- QMimeData *dat = new QMimeData;
- dat->clear();
- dat->setData("x-special/lumina-copied-files", items.join("\n").toLocal8Bit());
- QApplication::clipboard()->clear();
- QApplication::clipboard()->setMimeData(dat);
- ItemSelectionChanged();
-}
-
-void MainUI::CopyItems(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- //Get all the selected Items
- QFileInfoList sel = getSelectedItems();
- QStringList items;
- if(sel.isEmpty()){ return; } //nothing selected
- //Format the data string
- for(int i=0; i<sel.length(); i++){
- items << "copy::::"+sel[i].absoluteFilePath();
- //sel[i] = sel[i].prepend("copy::::");
- }
- //Now save that data to the global clipboard
- QMimeData *dat = new QMimeData;
- dat->clear();
- dat->setData("x-special/lumina-copied-files", items.join("\n").toLocal8Bit());
- QApplication::clipboard()->clear();
- QApplication::clipboard()->setMimeData(dat);
- ItemSelectionChanged();
-}
-
-void MainUI::PasteItems(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- const QMimeData *dat = QApplication::clipboard()->mimeData();
- if(!dat->hasFormat("x-special/lumina-copied-files")){ return; } //nothing to paste
- if(!checkUserPerms()){ return; }
- QStringList cut, copy, newcut, newcopy;
- QStringList raw = QString(dat->data("x-special/lumina-copied-files")).split("\n");
- QString base = getCurrentDir();
- if(!base.endsWith("/")){ base.append("/"); }
- for(int i=0; i<raw.length(); i++){
- if(raw[i].startsWith("cut::::")){
- cut << raw[i].section("::::",1,50);
- newcut << base+raw[i].section("::::",1,50).section("/",-1);
- }
- else if(raw[i].startsWith("copy::::")){
- copy << raw[i].section("::::",1,50);
- newcopy<< base+raw[i].section("::::",1,50).section("/",-1);
- }
- }
- bool errs = false;
- //Perform the copy/move operations
- if(!copy.isEmpty()){
- qDebug() << "Paste Copy:" << copy << "->" << newcopy;
- FODialog dlg(this);
- dlg.CopyFiles(copy, newcopy);
- dlg.show();
- dlg.exec();
- errs = errs || !dlg.noerrors;
- }
- if(!cut.isEmpty()){
- qDebug() << "Paste Cut:" << cut << "->" << newcut;
- FODialog dlg(this);
- dlg.MoveFiles(cut, newcut);
- dlg.show();
- dlg.exec();
- errs = errs || !dlg.noerrors;
- }
- //Modify the clipboard appropriately
- if(!errs && !cut.isEmpty()){
- //Now clear the clipboard since those old file locations are now invalid
- QApplication::clipboard()->clear();
- if(!copy.isEmpty()){
- //There were also files copied: save those files back into the clipboard
- QMimeData *dat = new QMimeData;
- dat->clear();
- dat->setData("x-special/lumina-copied-files", raw.filter("copy::::").join("\n").toLocal8Bit());
- QApplication::clipboard()->setMimeData(dat);
- }
- }
- ItemSelectionChanged();
-}
-
-void MainUI::ChecksumItems(){
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- QStringList info, files;
- for(int i=0; i<sel.length(); i++){
- files << sel[i].absoluteFilePath();
- }
- qDebug() << "Run Checksums:" << files;
- 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 MainUI::resizeEvent(QResizeEvent *event){
- //Save the new size internally
- settings->setValue("geometry/height", event->size().height());
- settings->setValue("geometry/width", event->size().width());
-}
diff --git a/lumina-fm/MainUI-old.h b/lumina-fm/MainUI-old.h
deleted file mode 100644
index cf9669b1..00000000
--- a/lumina-fm/MainUI-old.h
+++ /dev/null
@@ -1,238 +0,0 @@
-//===========================================
-// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-// This is the main interface for the Lumina File Manager (Insight)
-//===========================================
-#ifndef _LUMINA_FILE_MANAGER_UI_H
-#define _LUMINA_FILE_MANAGER_UI_H
-// Qt includes
-#include <QMainWindow>
-#include <QTabBar>
-#include <QLineEdit>
-#include <QFileSystemModel>
-#include <QStringList>
-#include <QDebug>
-#include <QAction>
-#include <QProcess>
-#include <QSettings>
-#include <QInputDialog>
-#include <QMessageBox>
-#include <QDir>
-#include <QTimer>
-#include <QDateTime>
-#include <QShortcut>
-#include <QCompleter>
-#include <QClipboard>
-#include <QMimeData>
-#include <QTreeWidgetItem>
-#include <QListWidgetItem>
-#include <QRadioButton>
-#include <QWidgetAction>
-#include <QImageReader>
-#include <QScrollBar>
-#include <QFileDialog>
-#include <QResizeEvent>
-#include <QDesktopWidget>
-#include <QThread>
-#include <QUrl>
-#include <QThread>
-
-//Multimedia Widgets
-#include <QVideoWidget>
-#include <QMediaPlayer>
-
-// libLumina includes
-#include <LuminaXDG.h>
-#include <LuminaOS.h>
-
-// Local includes
-#include "FODialog.h" //file operation dialog
-#include "BMMDialog.h" //bookmark manager dialog
-#include "MimeIconProvider.h" //icon provider for the view widgets
-#include "BackgroundWorker.h"
-#include "DDFileSystemModel.h"
-
-namespace Ui{
- class MainUI;
-};
-
-class MainUI : public QMainWindow{
- Q_OBJECT
-public:
- MainUI();
- ~MainUI();
-
- void OpenDirs(QStringList); //called from the main.cpp after initialization
-
-public slots:
- void setupIcons(); //used during initialization
-
-private:
- Ui::MainUI *ui;
- QThread *workThread;
- BackgroundWorker *worker;
- //Internal non-ui widgets
- QTabBar *tabBar;
- QLineEdit *currentDir;
- DDFileSystemModel *fsmod;
- QFileSystemModel *snapmod;
- //QFileSystemWatcher *fswatcher;
- MimeIconProvider *iconProv;
- QMenu *contextMenu;
- QRadioButton *radio_view_details, *radio_view_list, *radio_view_icons;
- QWidgetAction *detWA, *listWA, *icoWA;
- QString favdir;
-
- //Phonon Widgets for the multimedia player
- QMediaPlayer *mediaObj;
- QVideoWidget *videoDisplay;
- QSlider *playerSlider;
- QString playerTTime; //total time - to prevent recalculation every tick
-
- //Internal variables
- QStringList snapDirs; //internal saved variable for the discovered zfs snapshot dirs
- QString CItem; //the item that was right-clicked (for the context menu)
- //QStringList imgFilter, multiFilter; //image/multimedia filters
- QSettings *settings;
- QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort, *copyFilesShort, *cutFilesShort, *pasteFilesShort, *deleteFilesShort;
- QCompleter *dirCompleter;
- bool isUserWritable, keepFocus;
- QTimer *syncTimer;
-
- //Simplification Functions
- void setupConnections(); //used during initialization
- void loadSettings(); //used during initialization
-
- void RebuildBookmarksMenu();
- void RebuildDeviceMenu();
-
- bool checkUserPerms();
- QString msToText(qint64 ms);
-
- //Common functions for browser info/usage
- QString getCurrentDir();
- void setCurrentDir(QString);
- QFileInfoList getSelectedItems();
- //QModelIndexList getVisibleItems();
-
-private slots:
- void slotSingleInstance(QStringList in){
- this->show();
- this->raise();
- this->OpenDirs(in);
- }
-
- void slotStartSyncTimer();
-
- //General button check functions (started in a seperate thread!)
- void AvailableMultimediaFiles(QStringList files);
- void AvailableBackups(QString basedir, QStringList snapdirs);
- void AvailablePictures(QStringList files);
-
- //General page switching
- void goToMultimediaPage();
- void goToRestorePage();
- void goToSlideshowPage();
- void goToBrowserPage();
-
- //Menu Actions
- void on_actionNew_Tab_triggered();
- void on_actionSearch_triggered();
- void on_actionClose_triggered();
- void on_actionView_Hidden_Files_triggered();
- void on_actionShow_Action_Buttons_triggered();
- void on_actionShow_Thumbnails_triggered();
- void goToBookmark(QAction*);
- void goToDevice(QAction*);
- void viewModeChanged(bool);
-
- //Toolbar Actions
- void on_actionBack_triggered();
- void on_actionUpDir_triggered();
- void on_actionHome_triggered();
- void on_actionBookMark_triggered();
-
- //Browser Functions
- void startEditDir(QWidget *old, QWidget *now);
- void goToDirectory(); //go to a manually typed in directory
- void reloadDirectory(); //Update the widget with the dir contents
- void currentDirectoryLoaded(); //The file system model re-loaded the directory
- void on_tool_addToDir_clicked();
- void on_tool_addNewFile_clicked();
- void tabChanged(int tab);
- void tabClosed(int tab = -1);
- void prevTab();
- void nextTab();
- void ItemRun( const QModelIndex&);
- //void ItemRun(QTreeWidgetItem *item);
- //void ItemRun(QListWidgetItem *item);
- void OpenContextMenu(const QPoint&);
- void ItemSelectionChanged();
-
- //Slideshow Functions
- void showNewPicture();
- void firstPicture();
- void prevPicture();
- void nextPicture();
- void lastPicture();
- void removePicture();
- void rotatePictureLeft();
- void rotatePictureRight();
-
- //ZFS Restore Functions
- void snapshotLoaded();
- void showSnapshot();
- void nextSnapshot();
- void prevSnapshot();
- void restoreItems();
-
- //Multimedia Player Functions
- void playerStart();
- void playerError();
- void playerStop();
- void playerPause();
- void playerNext();
- void playerPrevious();
- void playerFinished(); //automatically called by the media object
- void playerStatusChanged(QMediaPlayer::MediaStatus stat); //automatically called
- void playerStateChanged(QMediaPlayer::State newstate); //automatically called by the media object
- void playerVideoAvailable(bool showVideo); //automatically called by the media object
- void playerDurationChanged(qint64);
- void playerTimeChanged(qint64 ctime); //automatically called by the media object
- void playerSliderMoved(int);
- void playerSliderHeld();
- void playerSliderChanged();
- void playerFileChanged();
-
- //Context Menu Actions
- void OpenItem(); //run "lumina-open" on it
- void OpenItemWith(); //run "lumina-open -select" on it
- //void OpenDir(); //open the dir in a new tab
- void RemoveItem(); //Remove the item permanently
- // - single item actions
- void RenameItem();
- void FavoriteItem();
- // - full selection actions
- void ViewPropertiesItem();
- void openTerminal();
- void CutItems();
- void CopyItems();
- void PasteItems();
- void ChecksumItems();
-
- //file info in status bar
- void DisplayStatusBar(QString);
-
-signals:
- void DirChanged(QString path);
- void Si_AdaptStatusBar(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles);
-
-protected:
- void resizeEvent(QResizeEvent*);
-
-};
-
-#endif
diff --git a/lumina-fm/MainUI-old.ui b/lumina-fm/MainUI-old.ui
deleted file mode 100644
index a978e871..00000000
--- a/lumina-fm/MainUI-old.ui
+++ /dev/null
@@ -1,1315 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainUI</class>
- <widget class="QMainWindow" name="MainUI">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>567</width>
- <height>415</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Insight</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="leftMargin">
- <number>1</number>
- </property>
- <property name="topMargin">
- <number>1</number>
- </property>
- <property name="rightMargin">
- <number>1</number>
- </property>
- <property name="bottomMargin">
- <number>1</number>
- </property>
- <item>
- <widget class="QStackedWidget" name="stackedWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="page_browser">
- <layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>1</number>
- </property>
- <property name="topMargin">
- <number>2</number>
- </property>
- <property name="rightMargin">
- <number>2</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="spacing">
- <number>1</number>
- </property>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_browser">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QListView" name="list_dir_view">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="showDropIndicator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="dragEnabled">
- <bool>true</bool>
- </property>
- <property name="dragDropMode">
- <enum>QAbstractItemView::InternalMove</enum>
- </property>
- <property name="defaultDropAction">
- <enum>Qt::MoveAction</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="textElideMode">
- <enum>Qt::ElideRight</enum>
- </property>
- <property name="isWrapping" stdset="0">
- <bool>true</bool>
- </property>
- <property name="resizeMode">
- <enum>QListView::Adjust</enum>
- </property>
- <property name="layoutMode">
- <enum>QListView::SinglePass</enum>
- </property>
- <property name="spacing">
- <number>1</number>
- </property>
- <property name="uniformItemSizes">
- <bool>false</bool>
- </property>
- <property name="batchSize">
- <number>10</number>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="selectionRectVisible">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTreeView" name="tree_dir_view">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="showDropIndicator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="dragEnabled">
- <bool>true</bool>
- </property>
- <property name="dragDropMode">
- <enum>QAbstractItemView::InternalMove</enum>
- </property>
- <property name="defaultDropAction">
- <enum>Qt::MoveAction</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="indentation">
- <number>0</number>
- </property>
- <property name="rootIsDecorated">
- <bool>false</bool>
- </property>
- <property name="uniformRowHeights">
- <bool>true</bool>
- </property>
- <property name="itemsExpandable">
- <bool>false</bool>
- </property>
- <property name="sortingEnabled">
- <bool>true</bool>
- </property>
- <property name="expandsOnDoubleClick">
- <bool>false</bool>
- </property>
- <attribute name="headerCascadingSectionResizes">
- <bool>true</bool>
- </attribute>
- <attribute name="headerMinimumSectionSize">
- <number>30</number>
- </attribute>
- <attribute name="headerStretchLastSection">
- <bool>true</bool>
- </attribute>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="0">
- <widget class="QGroupBox" name="group_actions">
- <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>
- <item row="1" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label_dir_stats">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_addNewFile">
- <property name="statusTip">
- <string>Create a new file</string>
- </property>
- <property name="text">
- <string>New &amp;file</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_addToDir">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="statusTip">
- <string>Create a new subdirectory</string>
- </property>
- <property name="text">
- <string notr="true">&amp;New Dir</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+N</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_goToPlayer">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Open Multimedia Player</string>
- </property>
- <property name="statusTip">
- <string>Play any multimedia files in this directory</string>
- </property>
- <property name="text">
- <string>&amp;Play</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+P, Ctrl+S</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_goToImages">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>View Slideshow</string>
- </property>
- <property name="statusTip">
- <string>View all the images in this directory as a slideshow</string>
- </property>
- <property name="text">
- <string>&amp;Slideshow</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+S</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_goToRestore">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Restore File(s)</string>
- </property>
- <property name="statusTip">
- <string>Restore old versions of files or directories</string>
- </property>
- <property name="text">
- <string>&amp;Backups</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+B</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_audioPlayer">
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="check_player_gotonext">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Go To Next</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_player_prev">
- <property name="text">
- <string notr="true">prev</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="combo_player_list">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_player_next">
- <property name="text">
- <string notr="true">next</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="videoLayout">
- <item>
- <widget class="QLabel" name="label_player_novideo">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <pointsize>13</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="styleSheet">
- <string notr="true">background: black; color: white;</string>
- </property>
- <property name="text">
- <string>(No Running Video)</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="videoControlLayout">
- <item>
- <widget class="QToolButton" name="tool_player_play">
- <property name="text">
- <string notr="true">play</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_player_pause">
- <property name="text">
- <string notr="true">pause</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_player_stop">
- <property name="text">
- <string notr="true">stop</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_4">
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_player_runstats">
- <property name="text">
- <string notr="true">?/?</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_image_view">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QToolButton" name="tool_image_remove">
- <property name="toolTip">
- <string>Delete this image file</string>
- </property>
- <property name="text">
- <string notr="true">...</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_8">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_image_rotateleft">
- <property name="toolTip">
- <string>Rotate this image file counter-clockwise</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_image_rotateright">
- <property name="toolTip">
- <string>Rotate this image file clockwise</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>
- </item>
- <item>
- <widget class="QLabel" name="label_image">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="styleSheet">
- <string notr="true">QLabel{ background: grey; }</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="scaledContents">
- <bool>false</bool>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <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>
- <item>
- <widget class="QToolButton" name="tool_image_goBegin">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Go to Beginning</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="shortcut">
- <string>Shift+Left</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_image_goPrev">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Go to Previous</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="shortcut">
- <string>Left</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line">
- <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>
- <widget class="QComboBox" name="combo_image_name">
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="frame">
- <bool>true</bool>
- </property>
- <item>
- <property name="text">
- <string>File Name</string>
- </property>
- </item>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_image_index">
- <property name="text">
- <string notr="true">1/10</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <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>
- <widget class="QToolButton" name="tool_image_goNext">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Go to Next</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="shortcut">
- <string>Right</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_image_goEnd">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Go to End</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="shortcut">
- <string>Shift+Right</string>
- </property>
- </widget>
- </item>
- <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>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_zfs">
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <widget class="QToolButton" name="tool_zfs_prevSnap">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="text">
- <string>Older</string>
- </property>
- <property name="shortcut">
- <string>Left</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextUnderIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QSlider" name="slider_zfs_snapshot">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="maximum">
- <number>20</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_zfs_snap">
- <property name="text">
- <string notr="true">Snapshot</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QToolButton" name="tool_zfs_nextSnap">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="text">
- <string>Newer</string>
- </property>
- <property name="shortcut">
- <string>Right</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextUnderIcon</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTreeView" name="tree_zfs_dir">
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
- <property name="rootIsDecorated">
- <bool>false</bool>
- </property>
- <property name="itemsExpandable">
- <bool>false</bool>
- </property>
- <property name="sortingEnabled">
- <bool>true</bool>
- </property>
- <property name="expandsOnDoubleClick">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_8">
- <item>
- <widget class="QToolButton" name="tool_zfs_restoreItem">
- <property name="toolTip">
- <string>Restore Selected Item</string>
- </property>
- <property name="text">
- <string>&amp;Restore Selection</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+R</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <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="QCheckBox" name="check_zfs_overwrite">
- <property name="text">
- <string>&amp;Overwrite Existing Files</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+O</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>567</width>
- <height>20</height>
- </rect>
- </property>
- <widget class="QMenu" name="menuFile">
- <property name="title">
- <string>File</string>
- </property>
- <addaction name="actionNew_Tab"/>
- <addaction name="actionSearch"/>
- <addaction name="separator"/>
- <addaction name="actionClose"/>
- </widget>
- <widget class="QMenu" name="menuView">
- <property name="title">
- <string>View</string>
- </property>
- <addaction name="actionShow_Thumbnails"/>
- <addaction name="actionView_Hidden_Files"/>
- <addaction name="actionShow_Action_Buttons"/>
- <addaction name="separator"/>
- </widget>
- <widget class="QMenu" name="menuBookmarks">
- <property name="title">
- <string>Bookmarks</string>
- </property>
- <addaction name="actionManage_Bookmarks"/>
- </widget>
- <widget class="QMenu" name="menuExternal_Devices">
- <property name="title">
- <string>External Devices</string>
- </property>
- <addaction name="actionScan"/>
- <addaction name="separator"/>
- </widget>
- <addaction name="menuFile"/>
- <addaction name="menuView"/>
- <addaction name="menuBookmarks"/>
- <addaction name="menuExternal_Devices"/>
- </widget>
- <widget class="QStatusBar" name="statusbar"/>
- <widget class="QToolBar" name="toolBar">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="windowTitle">
- <string>toolBar</string>
- </property>
- <property name="movable">
- <bool>false</bool>
- </property>
- <property name="floatable">
- <bool>false</bool>
- </property>
- <attribute name="toolBarArea">
- <enum>TopToolBarArea</enum>
- </attribute>
- <attribute name="toolBarBreak">
- <bool>false</bool>
- </attribute>
- <addaction name="actionBackToBrowser"/>
- <addaction name="actionBack"/>
- <addaction name="actionUpDir"/>
- <addaction name="actionHome"/>
- <addaction name="actionBookMark"/>
- </widget>
- <action name="actionNew_Tab">
- <property name="text">
- <string>New &amp;Tab</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+T</string>
- </property>
- </action>
- <action name="actionClose">
- <property name="text">
- <string>Exit</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+Q</string>
- </property>
- <property name="shortcutContext">
- <enum>Qt::ApplicationShortcut</enum>
- </property>
- </action>
- <action name="action_Preferences">
- <property name="text">
- <string>&amp;Preferences</string>
- </property>
- </action>
- <action name="actionUpDir">
- <property name="text">
- <string>UpDir</string>
- </property>
- <property name="toolTip">
- <string>Go up one directory</string>
- </property>
- <property name="shortcut">
- <string>Alt+Up</string>
- </property>
- </action>
- <action name="actionHome">
- <property name="text">
- <string>&amp;Home</string>
- </property>
- <property name="toolTip">
- <string>Go to your home directory</string>
- </property>
- <property name="shortcut">
- <string>Alt+H</string>
- </property>
- </action>
- <action name="actionView_Hidden_Files">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Show Hidden Files</string>
- </property>
- </action>
- <action name="actionBack">
- <property name="text">
- <string>Back</string>
- </property>
- <property name="toolTip">
- <string>Back to directory</string>
- </property>
- <property name="shortcut">
- <string>Alt+Left</string>
- </property>
- </action>
- <action name="actionBookMark">
- <property name="text">
- <string>Bookmark</string>
- </property>
- <property name="toolTip">
- <string>Bookmark this directory</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+D</string>
- </property>
- </action>
- <action name="actionScan">
- <property name="text">
- <string>Scan for Devices</string>
- </property>
- </action>
- <action name="actionBackToBrowser">
- <property name="text">
- <string notr="true">BBack</string>
- </property>
- <property name="iconText">
- <string notr="true">BBack</string>
- </property>
- <property name="toolTip">
- <string>Back to the system</string>
- </property>
- <property name="shortcut">
- <string>Alt+Left</string>
- </property>
- </action>
- <action name="actionManage_Bookmarks">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Manage Bookmarks</string>
- </property>
- <property name="whatsThis">
- <string notr="true"/>
- </property>
- </action>
- <action name="actionShow_Action_Buttons">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Show Action Buttons</string>
- </property>
- </action>
- <action name="actionShow_Thumbnails">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Load Thumbnails</string>
- </property>
- </action>
- <action name="actionSearch">
- <property name="text">
- <string>Search Directory</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+F</string>
- </property>
- </action>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index 732554dd..15b0f93e 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -1,13 +1,12 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
+// Copyright (c) 2014-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#include "MainUI.h"
#include "ui_MainUI.h"
-#include <QImageWriter>
#include <QFileInfo>
#define DEBUG 0
@@ -15,15 +14,16 @@
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
//for Signal/slot we must register the Typedef of QFileInfoList
qRegisterMetaType<QFileInfoList>("QFileInfoList");
+ qRegisterMetaType< LFileInfoList >("LFileInfoList");
ui->setupUi(this);
if(DEBUG){ qDebug() << "Initilization:"; }
//Be careful about the QSettings setup, it must match the lumina-desktop setup
QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
settings = new QSettings( QSettings::UserScope, "LuminaDE", "lumina-fm", this);
favdir = QDir::homePath()+"/.lumina/favorites/"; //save this for later
- syncTimer = new QTimer(this);
- syncTimer->setInterval(200); //1/5 second (collect as many signals/slots as necessary
- syncTimer->setSingleShot(true);
+ //syncTimer = new QTimer(this);
+ //syncTimer->setInterval(200); //1/5 second (collect as many signals/slots as necessary
+ //syncTimer->setSingleShot(true);
//Reset the UI to the previously used size (if possible)
if(DEBUG){ qDebug() << " - Reset window size"; }
int height = settings->value("geometry/height",-1).toInt();
@@ -37,75 +37,55 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
tabBar->setMovable(true); //tabs are independant - so allow the user to sort them
tabBar->setShape(QTabBar::RoundedNorth);
tabBar->setFocusPolicy(Qt::NoFocus);
- ui->verticalLayout_browser->insertWidget(0,tabBar);
- currentDir = new QLineEdit(this);
- ui->toolBar->insertWidget(ui->actionBookMark, currentDir);
- currentDir->setFocusPolicy(Qt::StrongFocus);
+ static_cast<QBoxLayout*>(ui->centralwidget->layout())->insertWidget(0,tabBar);
if(DEBUG){ qDebug() << " - Threading"; }
workThread = new QThread;
workThread->setObjectName("Lumina-fm filesystem worker");
- worker = new BackgroundWorker;
+ worker = new DirData();
+ worker->zfsavailable = LUtils::isValidBinary("zfs");
+ connect(worker, SIGNAL(DirDataAvailable(QString, QString, LFileInfoList)), this, SLOT(DirDataAvailable(QString, QString, LFileInfoList)) );
+ connect(worker, SIGNAL(SnapshotDataAvailable(QString, QString, QStringList)), this, SLOT(SnapshotDataAvailable(QString, QString, QStringList)) );
worker->moveToThread(workThread);
if(DEBUG){ qDebug() << " - File System Model"; }
- fsmod = new DDFileSystemModel(this);
- fsmod->setRootPath("/");
- //fsmod->setReadOnly(false); //required for DnD, but also enables a lot of other stuff
- //qDebug() << "DnD options:" << fsmod->supportedDropActions();
- ui->tree_dir_view->setModel(fsmod);
- ui->tree_dir_view->sortByColumn(0, Qt::AscendingOrder);
- ui->tree_dir_view->setColumnWidth(0,200);
- ui->tree_dir_view->setColumnWidth(1,80); //size column should be small
- ui->tree_dir_view->setColumnWidth(2,80); //type column should be small
- ui->list_dir_view->setModel(fsmod);
+ fsmod = new QFileSystemModel(this);
+ fsmod->setRootPath(QDir::homePath());
dirCompleter = new QCompleter(fsmod, this);
dirCompleter->setModelSorting( QCompleter::CaseInsensitivelySortedModel );
- currentDir->setCompleter(dirCompleter);
- snapmod = new QFileSystemModel(this);
- ui->tree_zfs_dir->setModel(snapmod);
- ui->tree_zfs_dir->sortByColumn(0, Qt::AscendingOrder);
- if(DEBUG){ qDebug() << " - Icon Provider"; }
- iconProv = new MimeIconProvider();
- fsmod->setIconProvider(iconProv);
- snapmod->setIconProvider(iconProv);
if(DEBUG){ qDebug() << " - Context Menu"; }
contextMenu = new QMenu(this);
radio_view_details = new QRadioButton(tr("Detailed List"), this);
radio_view_list = new QRadioButton(tr("Basic List"), this);
- radio_view_icons = new QRadioButton(tr("Icons"), this);
+ radio_view_tabs = new QRadioButton(tr("Prefer Tabs"), this);
+ radio_view_cols = new QRadioButton(tr("Prefer Columns"), this);
+ ui->menuView_Mode->clear();
+ ui->menuGroup_Mode->clear();
detWA = new QWidgetAction(this);
detWA->setDefaultWidget(radio_view_details);
listWA = new QWidgetAction(this);
listWA->setDefaultWidget(radio_view_list);
- icoWA = new QWidgetAction(this);
- icoWA->setDefaultWidget(radio_view_icons);
- ui->menuView->addAction(detWA);
- ui->menuView->addAction(listWA);
- ui->menuView->addAction(icoWA);
- //Setup the special Phonon widgets
- if(DEBUG){ qDebug() << " - Multimedia Widgets"; }
- mediaObj = new QMediaPlayer(this);
- mediaObj->setVolume(100);
- mediaObj->setNotifyInterval(500); //only every 1/2 second update
- videoDisplay = new QVideoWidget(this);
- videoDisplay->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- ui->videoLayout->addWidget(videoDisplay);
- mediaObj->setVideoOutput(videoDisplay);
- videoDisplay->setVisible(false);
- playerSlider = new QSlider(this);
- playerSlider->setOrientation(Qt::Horizontal);
- ui->videoControlLayout->insertWidget(4, playerSlider);
- ui->tool_player_stop->setEnabled(false); //nothing to stop yet
- ui->tool_player_pause->setVisible(false); //nothing to pause yet
- playerSlider->setEnabled(false); //nothing to seek yet
+ tabsWA = new QWidgetAction(this);
+ tabsWA->setDefaultWidget(radio_view_tabs);
+ colsWA = new QWidgetAction(this);
+ colsWA->setDefaultWidget(radio_view_cols);
+ ui->menuView_Mode->addAction(detWA);
+ ui->menuView_Mode->addAction(listWA);
+ ui->menuGroup_Mode->addAction(tabsWA);
+ ui->menuGroup_Mode->addAction(colsWA);
+ //Setup the pages
+ //ui->BrowserLayout->clear();
+ ui->page_player->setLayout(new QVBoxLayout());
+ ui->page_image->setLayout(new QVBoxLayout());
+ MW = new MultimediaWidget(this);
+ SW = new SlideshowWidget(this);
+ ui->page_player->layout()->addWidget(MW);
+ ui->page_image->layout()->addWidget(SW);
+
//Setup any specialty keyboard shortcuts
if(DEBUG){ qDebug() << " - Keyboard Shortcuts"; }
nextTabLShort = new QShortcut( QKeySequence(tr("Shift+Left")), this);
nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this);
closeTabShort = new QShortcut( QKeySequence(tr("Ctrl+W")), this);
- copyFilesShort = new QShortcut( QKeySequence(tr("Ctrl+C")), this);
- pasteFilesShort = new QShortcut( QKeySequence(tr("Ctrl+V")), this);
- cutFilesShort = new QShortcut( QKeySequence(tr("Ctrl+X")), this);
- deleteFilesShort = new QShortcut( QKeySequence(tr("Delete")), this);
+
//Finish loading the interface
workThread->start();
if(DEBUG){ qDebug() << " - Icons"; }
@@ -120,7 +100,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
RebuildDeviceMenu();
//Make sure we start on the browser page
if(DEBUG){ qDebug() << " - Load Browser Page"; }
- goToBrowserPage();
+ //goToBrowserPage();
if(DEBUG){ qDebug() << " - Done with init"; }
}
@@ -130,25 +110,67 @@ MainUI::~MainUI(){
}
void MainUI::OpenDirs(QStringList dirs){
+ if(dirs.isEmpty()){ dirs << QDir::homePath(); }
QStringList invalid;
for(int i=0; i<dirs.length(); i++){
- //Add this directory in a new tab
+ if(dirs[i].simplified().isEmpty()){ continue; }
+ //Open this directory in a viewer
if(dirs[i].endsWith("/")){ dirs[i].chop(1); }
if(!QFile::exists(dirs[i])){ invalid << dirs[i]; continue; }
if(DEBUG){ qDebug() << "Open Directory:" << dirs[i]; }
- int index = tabBar->addTab( dirs[i].section("/",-1) );
- tabBar->setTabWhatsThis( index, dirs[i] );
- if(index==0){ setCurrentDir(dirs[i]); }//display this as the current dir
- }
+ ///Get a new Unique ID
+ int id = 0;
+ for(int j=0; j<DWLIST.length(); j++){
+ if(DWLIST[j]->id().section("-",1,1).toInt() >= id){ id = DWLIST[j]->id().section("-",1,1).toInt()+1; }
+ }
+ //Create the new DirWidget
+ DirWidget *DW = new DirWidget("DW-"+QString::number(id), this);
+ ui->BrowserLayout->addWidget(DW);
+ DWLIST << DW;
+ //Connect the signals/slots for it
+ connect(DW, SIGNAL(OpenDirectories(QStringList)), this, SLOT(OpenDirs(QStringList)) );
+ connect(DW, SIGNAL(LoadDirectory(QString, QString)), worker, SLOT(GetDirData(QString, QString)) );
+ connect(DW, SIGNAL(findSnaps(QString, QString)), worker, SLOT(GetSnapshotData(QString, QString)) );
+ connect(DW, SIGNAL(PlayFiles(LFileInfoList)), this, SLOT(OpenPlayer(LFileInfoList)) );
+ connect(DW, SIGNAL(ViewFiles(LFileInfoList)), this, SLOT(OpenImages(LFileInfoList)) );
+ connect(DW, SIGNAL(LaunchTerminal(QString)), this, SLOT(OpenTerminal(QString)) );
+ connect(DW, SIGNAL(CutFiles(QStringList)), this, SLOT(CutFiles(QStringList)) );
+ connect(DW, SIGNAL(CopyFiles(QStringList)), this, SLOT(CopyFiles(QStringList)) );
+ connect(DW, SIGNAL(FavoriteFiles(QStringList)), this, SLOT(FavoriteFiles(QStringList)) );
+ connect(DW, SIGNAL(RenameFiles(QStringList)), this, SLOT(RenameFiles(QStringList)) );
+ connect(DW, SIGNAL(RemoveFiles(QStringList)), this, SLOT(RemoveFiles(QStringList)) );
+ connect(DW, SIGNAL(PasteFiles(QString)), this, SLOT(PasteFiles(QString)) );
+ connect(DW, SIGNAL(CloseBrowser(QString)), this, SLOT(CloseBrowser(QString)) );
+ //Now create the tab for this
+ if(radio_view_tabs->isChecked()){
+ int index = tabBar->addTab( LXDG::findIcon("folder-open",""), dirs[i].section("/",-1) );
+ tabBar->setTabWhatsThis( index, "DW-"+QString::number(id) );
+ tabBar->setCurrentIndex(index);
+ }else if(tabBar->count()<1){
+ //Need to create the generic Browser tab
+
+ }
+
+ //Initialize the widget with the proper settings
+ DW->setShowDetails(radio_view_details->isChecked());
+ DW->setShowSidebar(ui->actionShow_Action_Buttons->isChecked());
+ QList<DirWidget::DETAILTYPES> details; details <<DirWidget::NAME << DirWidget::SIZE << DirWidget::TYPE << DirWidget::DATEMOD;
+ DW->setDetails(details); //Which details to show and in which order (L->R)
+ DW->setShowThumbnails(ui->actionShow_Thumbnails->isChecked());
+ DW->setThumbnailSize(settings->value("iconsize", 32).toInt());
+ DW->setDirCompleter(dirCompleter);
+ DW->setShowCloseButton(!radio_view_tabs->isChecked());
+ //Now load the directory
+ DW->ChangeDir(dirs[i]); //kick off loading the directory info
+ }
+ //Update visibilities
+ tabChanged(tabBar->currentIndex());
tabBar->setVisible( tabBar->count() > 1 );
if(!invalid.isEmpty()){
QMessageBox::warning(this, tr("Invalid Directories"), tr("The following directories are invalid and could not be opened:")+"\n"+invalid.join(", ") );
}
}
-//==========
-// PRIVATE
-//==========
void MainUI::setupIcons(){
this->setWindowIcon( LXDG::findIcon("Insight-FileManager","") );
@@ -156,139 +178,37 @@ void MainUI::setupIcons(){
ui->actionClose->setIcon( LXDG::findIcon("application-exit","") );
ui->actionNew_Tab->setIcon( LXDG::findIcon("tab-new-background","") );
//ui->action_Preferences->setIcon( LXDG::findIcon("configure","") );
- ui->actionUpDir->setIcon( LXDG::findIcon("go-up","") );
- ui->actionBack->setIcon( LXDG::findIcon("go-previous","") );
- ui->actionHome->setIcon( LXDG::findIcon("go-home","") );
- ui->actionBookMark->setIcon( LXDG::findIcon("bookmarks","") );
- ui->actionBackToBrowser->setIcon( LXDG::findIcon("go-previous","") );
ui->actionManage_Bookmarks->setIcon( LXDG::findIcon("bookmarks-organize","") );
ui->actionScan->setIcon( LXDG::findIcon("system-search","") );
ui->actionSearch->setIcon( LXDG::findIcon("edit-find","") );
-
- //Browser page
- ui->tool_addNewFile->setIcon( LXDG::findIcon("document-new",""));
- ui->tool_addToDir->setIcon( LXDG::findIcon("folder-new","") );
- ui->tool_goToImages->setIcon( LXDG::findIcon("fileview-preview","") );
- ui->tool_goToPlayer->setIcon( LXDG::findIcon("applications-multimedia","") );
- ui->tool_goToRestore->setIcon( LXDG::findIcon("document-revert","") );
- ui->tool_act_run->setIcon( LXDG::findIcon("run-build-file","") );
- ui->tool_act_runwith->setIcon( LXDG::findIcon("run-build-configure","") );
- ui->tool_act_cut->setIcon( LXDG::findIcon("edit-cut","") );
- ui->tool_act_copy->setIcon( LXDG::findIcon("edit-copy","") );
- ui->tool_act_paste->setIcon( LXDG::findIcon("edit-paste","") );
- ui->tool_act_rename->setIcon( LXDG::findIcon("edit-rename","") );
- ui->tool_act_rm->setIcon( LXDG::findIcon("edit-delete","") );
- ui->tool_act_fav->setIcon( LXDG::findIcon("bookmark-toolbar","") );
-
- //Multimedia Player page
- ui->tool_player_next->setIcon( LXDG::findIcon("media-skip-forward","") );
- ui->tool_player_prev->setIcon( LXDG::findIcon("media-skip-backward","") );
- ui->tool_player_pause->setIcon( LXDG::findIcon("media-playback-pause","") );
- ui->tool_player_play->setIcon( LXDG::findIcon("media-playback-start","") );
- ui->tool_player_stop->setIcon( LXDG::findIcon("media-playback-stop","") );
-
- //Slideshow page
- ui->tool_image_goBegin->setIcon( LXDG::findIcon("go-first-view","") );
- ui->tool_image_goEnd->setIcon( LXDG::findIcon("go-last-view","") );
- ui->tool_image_goPrev->setIcon( LXDG::findIcon("go-previous-view","") );
- ui->tool_image_goNext->setIcon( LXDG::findIcon("go-next-view","") );
- ui->tool_image_remove->setIcon( LXDG::findIcon("edit-delete","") );
- ui->tool_image_rotateleft->setIcon( LXDG::findIcon("object-rotate-left","") );
- ui->tool_image_rotateright->setIcon( LXDG::findIcon("object-rotate-right","") );
+ ui->actionLarger_Icons->setIcon( LXDG::findIcon("zoom-in","") );
+ ui->actionSmaller_Icons->setIcon( LXDG::findIcon("zoom-out", "") );
+ //Menu Icons
+ ui->menuView_Mode->setIcon( LXDG::findIcon("view-choose","") );
+ ui->menuGroup_Mode->setIcon( LXDG::findIcon("tab-duplicate","") );
- //ZFS Restore page
- ui->tool_zfs_nextSnap->setIcon( LXDG::findIcon("go-next-view","") );
- ui->tool_zfs_prevSnap->setIcon( LXDG::findIcon("go-previous-view","") );
- ui->tool_zfs_restoreItem->setIcon( LXDG::findIcon("document-revert","") );
}
+//==========
+// PRIVATE
+//==========
void MainUI::setupConnections(){
- connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(startEditDir(QWidget*, QWidget*)) );
connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)) );
connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) );
connect(ui->menuBookmarks, SIGNAL(triggered(QAction*)), this, SLOT(goToBookmark(QAction*)) );
connect(ui->menuExternal_Devices, SIGNAL(triggered(QAction*)), this, SLOT(goToDevice(QAction*)) );
- connect(currentDir, SIGNAL(returnPressed()), this, SLOT(goToDirectory()));
+
+ //Radio Buttons
connect(radio_view_details, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) );
connect(radio_view_list, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) );
- connect(radio_view_icons, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) );
- connect(fsmod, SIGNAL(directoryLoaded(QString)), this, SLOT(slotStartSyncTimer()) );
- connect(syncTimer, SIGNAL(timeout()), this, SLOT(currentDirectoryLoaded()) );
- //Background worker class
- connect(this, SIGNAL(DirChanged(QString)), worker, SLOT(startDirChecks(QString)) );
- connect(worker, SIGNAL(ImagesAvailable(QStringList)), this, SLOT(AvailablePictures(QStringList)) );
- connect(worker, SIGNAL(MultimediaAvailable(QStringList)), this, SLOT(AvailableMultimediaFiles(QStringList)) );
- connect(worker, SIGNAL(SnapshotsAvailable(QString, QStringList)), this, SLOT(AvailableBackups(QString, QStringList)) );
+ connect(radio_view_tabs, SIGNAL(toggled(bool)), this, SLOT(groupModeChanged(bool)) );
+ connect(radio_view_cols, SIGNAL(toggled(bool)), this, SLOT(groupModeChanged(bool)) );
- //Background worker class for statusbar
- connect(this, SIGNAL(Si_AdaptStatusBar(QFileInfoList, QString, QString, QString)), worker, SLOT(createStatusBarMsg(QFileInfoList, QString, QString, QString)) );
- connect(worker, SIGNAL(Si_DisplayStatusBar(QString)), this, SLOT(DisplayStatusBar(QString)) );
-
- //Action buttons on browser page
- connect(ui->tool_act_run, SIGNAL(clicked()), this, SLOT(OpenItem()) );
- connect(ui->tool_act_runwith, SIGNAL(clicked()), this, SLOT(OpenItemWith()) );
- connect(ui->tool_act_rm, SIGNAL(clicked()), this, SLOT(RemoveItem()) );
- connect(ui->tool_act_rename, SIGNAL(clicked()), this, SLOT(RenameItem()) );
- connect(ui->tool_act_paste, SIGNAL(clicked()), this, SLOT(PasteItems()) );
- connect(ui->tool_act_cut, SIGNAL(clicked()), this, SLOT(CutItems()) );
- connect(ui->tool_act_copy, SIGNAL(clicked()), this, SLOT(CopyItems()) );
- connect(ui->tool_act_fav, SIGNAL(clicked()), this, SLOT(FavoriteItem()) );
-
- //Tree Widget interaction
- 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()) );
-
- //Page Switching
- connect(ui->tool_goToPlayer, SIGNAL(clicked()), this, SLOT(goToMultimediaPage()) );
- connect(ui->tool_goToRestore, SIGNAL(clicked()), this, SLOT(goToRestorePage()) );
- connect(ui->tool_goToImages, SIGNAL(clicked()), this, SLOT(goToSlideshowPage()) );
- connect(ui->actionBackToBrowser, SIGNAL(triggered()), this, SLOT(goToBrowserPage()) );
-
- //Slideshow page
- connect(ui->combo_image_name, SIGNAL(currentIndexChanged(int)), this, SLOT(showNewPicture()) );
- connect(ui->tool_image_goBegin, SIGNAL(clicked()), this, SLOT(firstPicture()) );
- connect(ui->tool_image_goEnd, SIGNAL(clicked()), this, SLOT(lastPicture()) );
- connect(ui->tool_image_goNext, SIGNAL(clicked()), this, SLOT(nextPicture()) );
- connect(ui->tool_image_goPrev, SIGNAL(clicked()), this, SLOT(prevPicture()) );
- connect(ui->tool_image_remove, SIGNAL(clicked()), this, SLOT(removePicture()) );
- connect(ui->tool_image_rotateleft, SIGNAL(clicked()), this, SLOT(rotatePictureLeft()) );
- connect(ui->tool_image_rotateright, SIGNAL(clicked()), this, SLOT(rotatePictureRight()) );
-
- //ZFS Restore page
- connect(ui->slider_zfs_snapshot, SIGNAL(valueChanged(int)), this, SLOT(showSnapshot()) );
- connect(ui->tool_zfs_nextSnap, SIGNAL(clicked()), this, SLOT(nextSnapshot()) );
- connect(ui->tool_zfs_prevSnap, SIGNAL(clicked()), this, SLOT(prevSnapshot()) );
- connect(ui->tool_zfs_restoreItem, SIGNAL(clicked()), this, SLOT(restoreItems()) );
-
- //Multimedia Player page
- connect(ui->tool_player_next, SIGNAL(clicked()), this, SLOT(playerNext()));
- connect(ui->tool_player_prev, SIGNAL(clicked()), this, SLOT(playerPrevious()));
- connect(ui->tool_player_pause, SIGNAL(clicked()), this, SLOT(playerPause()));
- connect(ui->tool_player_play, SIGNAL(clicked()), this, SLOT(playerStart()));
- connect(ui->tool_player_stop, SIGNAL(clicked()), this, SLOT(playerStop()));
- connect(ui->combo_player_list, SIGNAL(currentIndexChanged(int)), this, SLOT(playerFileChanged()) );
- connect(playerSlider, SIGNAL(sliderPressed()), this, SLOT(playerSliderHeld()) );
- connect(playerSlider, SIGNAL(sliderReleased()), this, SLOT(playerSliderChanged()) );
- connect(playerSlider, SIGNAL(valueChanged(int)), this, SLOT(playerSliderMoved(int)) );
- connect(mediaObj, SIGNAL(durationChanged(qint64)), this, SLOT(playerDurationChanged(qint64)) );
- connect(mediaObj, SIGNAL(seekableChanged(bool)), playerSlider, SLOT(setEnabled(bool)) );
- connect(mediaObj, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(playerStatusChanged(QMediaPlayer::MediaStatus)) );
- connect(mediaObj, SIGNAL(positionChanged(qint64)), this, SLOT(playerTimeChanged(qint64)) );
- connect(mediaObj, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged(QMediaPlayer::State)) );
- connect(mediaObj, SIGNAL(videoAvailableChanged(bool)), this, SLOT(playerVideoAvailable(bool)) );
- connect(mediaObj, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(playerError()) );
//Special Keyboard Shortcuts
connect(nextTabLShort, SIGNAL(activated()), this, SLOT( prevTab() ) );
connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) );
connect(closeTabShort, SIGNAL(activated()), this, SLOT( tabClosed() ) );
- connect(copyFilesShort, SIGNAL(activated()), this, SLOT( CopyItems() ) );
- connect(cutFilesShort, SIGNAL(activated()), this, SLOT( CutItems() ) );
- connect(pasteFilesShort, SIGNAL(activated()), this, SLOT( PasteItems() ) );
- connect(deleteFilesShort, SIGNAL(activated()), this, SLOT( RemoveItem() ) );
+
}
void MainUI::loadSettings(){
@@ -299,11 +219,15 @@ void MainUI::loadSettings(){
ui->actionShow_Action_Buttons->setChecked(settings->value("showactions", true).toBool() );
on_actionShow_Action_Buttons_triggered(); //make sure to update the UI
ui->actionShow_Thumbnails->setChecked( settings->value("showthumbnails", true).toBool() );
- iconProv->showthumbnails = ui->actionShow_Thumbnails->isChecked();
- QString view = settings->value("viewmode","details").toString();
- if(view=="icons"){ radio_view_icons->setChecked(true); }
- else if(view=="list"){ radio_view_list->setChecked(true); }
- else{ radio_view_details->setChecked(true); }
+ //View Type
+ bool showDetails = (settings->value("viewmode","details").toString()=="details");
+ if(showDetails){ radio_view_details->setChecked(true); }
+ else{ radio_view_list->setChecked(true); }
+ //Grouping type
+ bool usetabs = (settings->value("groupmode","tabs").toString()=="tabs");
+ if(usetabs){ radio_view_tabs->setChecked(true); }
+ else{ radio_view_cols->setChecked(true); }
+
}
void MainUI::RebuildBookmarksMenu(){
@@ -374,325 +298,36 @@ void MainUI::RebuildDeviceMenu(){
}
}
-bool MainUI::checkUserPerms(){
- if(!isUserWritable){
- QMessageBox::warning(this, tr("Invalid Permissions"), tr("You do not have permission to edit this directory!") );
- }
- return isUserWritable;
-}
-
-QString MainUI::msToText(qint64 ms){
- QString disp;
- if(ms>3600000){
- disp.append( QString::number(ms/3600000)+":" );
- ms = ms%3600000;
- }
- if(ms>60000){
- disp.append( QString::number(ms/60000)+":" );
- ms = ms%60000;
- }else{
- disp.append("0:");
- }
- if(ms>1000){
- if(ms>=10000){ disp.append( QString::number(ms/1000) ); }
- else{ disp.append( "0"+QString::number(ms/1000) ); }
- }else{
- disp.append("00");
- }
- return disp;
-}
-
-QString MainUI::getCurrentDir(){
- return currentDir->whatsThis();
-}
-
-void MainUI::setCurrentDir(QString dir){
- if(dir.isEmpty()){ return; }
- if(syncTimer->isActive()){ syncTimer->stop(); } //already loading the info
- QFileInfo info(dir);
- QString olddir = currentDir->whatsThis();
- if(!info.isDir() || !info.exists() ){
- qDebug() << "Invalid Directory:" << dir;
- //Try to just go up the dir tree one level
- dir.chop(dir.section("/",-1).length());
- if(!QFile::exists(dir)){
- //Still bad dir - try to return to previously shown dir
- if(currentDir->whatsThis().isEmpty()){ return; } //nothing to return to
- else{ dir = currentDir->whatsThis(); }
- }
- }
- //qDebug() << "Show Directory:" << dir;
- //qDebug() << "Dir Info:" << dir;
- //qDebug() << " - RWXLOG:" << info.isReadable() << info.isWritable() << info.isExecutable() << info.isSymLink() << info.ownerId() << info.groupId();
- isUserWritable = info.isWritable();
- if(dir.endsWith("/") && dir!="/" ){ dir.chop(1); }
- QString rawdir = dir;
- //dir.replace(QDir::homePath()+"/", "~/");
- currentDir->setText(dir);
- //Update the directory viewer and update the line edit
- keepFocus = !currentDir->hasFocus();
- currentDir->setWhatsThis(dir); //save the full path internally
- fsmod->setRootPath(rawdir);
- if(radio_view_details->isChecked()){
- ui->tree_dir_view->setRootIndex(fsmod->index(dir));
- ui->tree_dir_view->selectionModel()->clearSelection();
- if(olddir.startsWith(rawdir)){
- ui->tree_dir_view->setCurrentIndex( fsmod->index(olddir));
- ui->tree_dir_view->scrollTo( fsmod->index(olddir), QAbstractItemView::PositionAtTop);
- }
- }else{
- ui->list_dir_view->setRootIndex(fsmod->index(dir));
- ui->list_dir_view->selectionModel()->clearSelection();
- if(olddir.startsWith(rawdir)){
- ui->list_dir_view->setCurrentIndex( fsmod->index(olddir));
- ui->list_dir_view->scrollTo( fsmod->index(olddir), QAbstractItemView::PositionAtTop);
- }
- }
- //Adjust the tab data
- tabBar->setTabWhatsThis( tabBar->currentIndex(), rawdir );
- if(dir!="/"){ tabBar->setTabText( tabBar->currentIndex(), dir.section("/",-1) ); }
- else{ tabBar->setTabText( tabBar->currentIndex(), dir); }
- QStringList history = tabBar->tabData(tabBar->currentIndex()).toStringList();
- if(history.isEmpty() || history.first()!=rawdir){ history.prepend(rawdir); history.removeAll(""); }
- //qDebug() << "History:" << history;
- tabBar->setTabData(tabBar->currentIndex(), history);
- //Now adjust the items as necessary
- if(rawdir != olddir){
- //The Filesystem model will need to load the new directory (triggering the background checks)
- ui->tool_goToPlayer->setVisible(false);
- ui->tool_goToRestore->setVisible(false);
- ui->tool_goToImages->setVisible(false);
- }
- //Make sure the shortcut buttons are enabled as necessary
- // If the dir is already loaded into the fsmodel cache it will not emit the directoryLoaded() signal
- /*if(rawdir == olddir){
- emit DirChanged(rawdir); //This will be automatically run when a new dir is loaded
- }
- emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), rawdir, tr("Items"));*/
- if(isUserWritable){ ui->label_dir_stats->setText(""); }
- else{ ui->label_dir_stats->setText(tr("Limited Access Directory"));
- }
-
- ui->tool_addToDir->setVisible(isUserWritable);
- ui->tool_addNewFile->setVisible(isUserWritable);
- ui->actionUpDir->setEnabled(dir!="/");
- ui->actionBack->setEnabled(history.length() > 1);
- ui->actionBookMark->setEnabled( rawdir!=QDir::homePath() && settings->value("bookmarks", QStringList()).toStringList().filter("::::"+rawdir).length()<1 );
- ItemSelectionChanged();
- RebuildDeviceMenu(); //keep this refreshed
-
-}
-
-QFileInfoList MainUI::getSelectedItems(){
- QFileInfoList out;
- if(radio_view_details->isChecked()){
- QModelIndexList items = ui->tree_dir_view->selectionModel()->selectedIndexes();
- for(int i=0; i<items.length(); i++){
- if(!out.contains(fsmod->fileInfo(items[i]))){
- out << fsmod->fileInfo(items[i]);
- }
- }
- }else{
- QModelIndexList items = ui->list_dir_view->selectionModel()->selectedIndexes();
- for(int i=0; i<items.length(); i++){
- if(!out.contains(fsmod->fileInfo(items[i]))){
- out << fsmod->fileInfo(items[i]);
- }
- }
- }
- return out;
-}
-/*QModelIndexList MainUI::getVisibleItems(){
- QModelIndexList out;
- if(radio_view_details->isChecked()){
- QModelIndex index = ui->tree_dir_view->indexAt(QPoint(0,0));
- while( index.isValid()){
- if(index.column()!=0){
- //move on - multiple index's per row when we only need one
- }else if(ui->tree_dir_view->viewport()->rect().contains( ui->tree_dir_view->visualRect(index) ) ){
- //index within the viewport - add it to the list
- out << index;
- }else{
- break; //index not in the viewport
- }
- index = ui->tree_dir_view->indexBelow(index); //go to the next
- if(out.contains(index)){ break; } //end of the list
- }
-
- }else{
- QModelIndex index = ui->list_dir_view->indexAt(QPoint(0,0));
- while( index.isValid()){
- if(ui->list_dir_view->viewport()->rect().contains( ui->list_dir_view->visualRect(index) ) ){
- //index within the viewport - add it to the list
- out << index;
- }else{
- break; //index not in the viewport
- }
- index = ui->list_dir_view->indexBelow(index); //go to the next
- if(out.contains(index)){ break; } //end of the list
- }
-
- }
- return out;
-}*/
//==============
// PRIVATE SLOTS
//==============
-void MainUI::slotStartSyncTimer(){
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- if(syncTimer->isActive()){ syncTimer->stop(); }
- syncTimer->start();
-}
-
-//General button check functions
-void MainUI::AvailableMultimediaFiles(QStringList files){
- if(!files.isEmpty()){
- ui->combo_player_list->clear();
- ui->combo_player_list->addItems(files);
- ui->tool_goToPlayer->setVisible(true);
- }else{
- ui->tool_goToPlayer->setVisible(false);
- }
-
-}
-
-void MainUI::AvailableBackups(QString basedir, QStringList snapdirs){
- snapmod->setRootPath(basedir); //set the base snapshot dir as the new root
- snapDirs = snapdirs;
-
- //Now enable the button if any snapshots available
- ui->tool_goToRestore->setVisible(!snapDirs.isEmpty());
-}
-
void MainUI::DisplayStatusBar(QString msg){
//qDebug() << "message to show in the status bar:" << msg;
ui->statusbar->showMessage(msg);
}
-
-void MainUI::AvailablePictures(QStringList pics){
- if(!pics.isEmpty()){
- QString citem = ui->combo_image_name->currentText();
- ui->combo_image_name->clear();
- ui->combo_image_name->addItems(pics);
- if(pics.contains(citem)){
- ui->combo_image_name->setCurrentText(citem);
- }
- ui->tool_goToImages->setVisible(true);
- }
-
-}
-
-//-----------------------------------
-//General page switching
-//-----------------------------------
-void MainUI::goToMultimediaPage(){
- //Make toolbar items disappear appropriately
- ui->actionBackToBrowser->setVisible(true);
- ui->actionBack->setVisible(false);
- ui->actionUpDir->setVisible(false);
- ui->actionHome->setVisible(false);
- ui->actionBookMark->setVisible(false);
- currentDir->setEnabled(false);
- //Disable all the UI elements specifically for the Browser side of things
- ui->actionNew_Tab->setEnabled(false);
- ui->menuView->setEnabled(false);
- ui->menuBookmarks->setEnabled(false);
- ui->menuExternal_Devices->setEnabled(false);
- //Start the player on the first selected item
- QFileInfoList sel = getSelectedItems();
- if(!sel.isEmpty()){
- QStringList names;
- for(int i=0; i<sel.length(); i++){ names << sel[i].fileName(); }
- //start the slideshow on the first selected picture
- for(int i=0; i<ui->combo_player_list->count(); i++){
- if(names.contains( ui->combo_player_list->itemText(i) )){ ui->combo_player_list->setCurrentIndex(i); break; }
- }
- }
- //Now go to the Multimedia player
- ui->label_player_novideo->setText(tr("Click Play to Start"));
- ui->stackedWidget->setCurrentWidget(ui->page_audioPlayer);
-}
-
-void MainUI::goToRestorePage(){
- //Make toolbar items disappear appropriately
- ui->actionBackToBrowser->setVisible(true);
- ui->actionBack->setVisible(false);
- ui->actionUpDir->setVisible(false);
- ui->actionHome->setVisible(false);
- ui->actionBookMark->setVisible(false);
- currentDir->setEnabled(false);
- //Disable all the UI elements specifically for the Browser side of things
- ui->actionNew_Tab->setEnabled(false);
- ui->menuView->setEnabled(false);
- ui->menuBookmarks->setEnabled(false);
- ui->menuExternal_Devices->setEnabled(false);
- //Load all the info into the file restore page
- ui->slider_zfs_snapshot->setRange(1,snapDirs.length());
- ui->slider_zfs_snapshot->setValue(snapDirs.length());
- //Now go to the file restore page
- showSnapshot(); //Make sure it is updated for the current directory
- ui->stackedWidget->setCurrentWidget(ui->page_zfs);
-}
-
-void MainUI::goToSlideshowPage(){
- //Make toolbar items disappear appropriately
- ui->actionBackToBrowser->setVisible(true);
- ui->actionBack->setVisible(false);
- ui->actionUpDir->setVisible(false);
- ui->actionHome->setVisible(false);
- ui->actionBookMark->setVisible(false);
- currentDir->setEnabled(false);
- //Disable all the UI elements specifically for the Browser side of things
- ui->actionNew_Tab->setEnabled(false);
- ui->menuView->setEnabled(false);
- ui->menuBookmarks->setEnabled(false);
- ui->menuExternal_Devices->setEnabled(false);
- QFileInfoList sel = getSelectedItems();
- if(!sel.isEmpty()){
- QStringList names;
- for(int i=0; i<sel.length(); i++){ names << sel[i].fileName(); }
- //start the slideshow on the first selected picture
- for(int i=0; i<ui->combo_image_name->count(); i++){
- if(names.contains( ui->combo_image_name->itemText(i) )){ ui->combo_image_name->setCurrentIndex(i); break; }
- }
- }
- //Now go to the Slideshow player
- ui->stackedWidget->setCurrentWidget(ui->page_image_view);
- showNewPicture(); //make sure it is up to date with the widget size
-}
-
-void MainUI::goToBrowserPage(){
- //Make toolbar items re-appear appropriately
- ui->actionBackToBrowser->setVisible(false);
- ui->actionBack->setVisible(true);
- ui->actionUpDir->setVisible(true);
- ui->actionHome->setVisible(true);
- ui->actionBookMark->setVisible(true);
- currentDir->setEnabled(true);
- //Disable all the UI elements specifically for the Browser side of things
- ui->actionNew_Tab->setEnabled(true);
- ui->menuView->setEnabled(true);
- ui->menuBookmarks->setEnabled(true);
- ui->menuExternal_Devices->setEnabled(true);
- //Now go to the browser
- if(ui->stackedWidget->currentWidget()==ui->page_audioPlayer){ mediaObj->stop(); }
- ui->stackedWidget->setCurrentWidget(ui->page_browser);
- reloadDirectory();
-}
//---------------------
//Menu Actions
//---------------------
void MainUI::on_actionNew_Tab_triggered(){
OpenDirs(QStringList() << QDir::homePath());
- //Now go to that tab (always last)
- tabBar->setCurrentIndex(tabBar->count()-1);
}
void MainUI::on_actionSearch_triggered(){
- QProcess::startDetached("lumina-search -dir \""+getCurrentDir()+"\"");
+ //Find the current directory
+ QString cur = tabBar->tabWhatsThis(tabBar->currentIndex());
+ if(cur.startsWith("#")){ cur.clear(); } //multimedia/player tab open
+ else{
+ for(int i=0; i<DWLIST.length(); i++){
+ if(DWLIST[i]->id()==cur){
+ //Found the current browser - load it here
+ QProcess::startDetached("lumina-search -dir \""+DWLIST[i]->currentDir()+"\"");
+ return;
+ }
+ }
+ }
}
void MainUI::on_actionClose_triggered(){
@@ -706,33 +341,26 @@ void MainUI::on_actionClose_triggered(){
}
void MainUI::on_actionView_Hidden_Files_triggered(){
- if(ui->actionView_Hidden_Files->isChecked()){
- fsmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden );
- snapmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden );
- }else{
- fsmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs );
- snapmod->setFilter( QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs );
- }
+ worker->showHidden = ui->actionView_Hidden_Files->isChecked();
//Now save this setting for later
settings->setValue("showhidden", ui->actionView_Hidden_Files->isChecked());
- //Re-load the view widget
- setCurrentDir(getCurrentDir());
+ worker->showHidden = ui->actionView_Hidden_Files->isChecked();
+ //Re-load the current browsers
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->refresh(); }
+
}
void MainUI::on_actionShow_Action_Buttons_triggered(){
- ui->group_actions->setVisible(ui->actionShow_Action_Buttons->isChecked());
- settings->setValue("showactions", ui->actionShow_Action_Buttons->isChecked());
+ bool show = ui->actionShow_Action_Buttons->isChecked();
+ settings->setValue("showactions", show);
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->setShowSidebar(show); }
}
void MainUI::on_actionShow_Thumbnails_triggered(){
//Now save this setting for later
- settings->setValue("showthumbnails", ui->actionShow_Thumbnails->isChecked());
- //Set the value in the icon provider
- iconProv->showthumbnails = ui->actionShow_Thumbnails->isChecked();
- //Now make sure the filesystem model knows to re-load the image data
- fsmod->revert();
- //Re-load the view widget
- setCurrentDir(getCurrentDir());
+ bool show = ui->actionShow_Thumbnails->isChecked();
+ settings->setValue("showthumbnails", show);
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->setShowThumbnails(show); }
}
void MainUI::goToBookmark(QAction *act){
@@ -742,7 +370,20 @@ void MainUI::goToBookmark(QAction *act){
dlg.exec();
RebuildBookmarksMenu();
}else{
- setCurrentDir(act->whatsThis());
+ //Find the current directory
+ QString cur = tabBar->tabWhatsThis(tabBar->currentIndex());
+ if(cur.startsWith("#")){ cur.clear(); } //multimedia/player tab open
+ else{
+ for(int i=0; i<DWLIST.length(); i++){
+ if(DWLIST[i]->id()==cur){
+ //Found the current browser - load it here
+ DWLIST[i]->ChangeDir(act->whatsThis());
+ return;
+ }
+ }
+ }
+ //If no current dir could be found - open a new tab/column
+ OpenDirs(QStringList() << act->whatsThis() );
}
}
@@ -750,58 +391,79 @@ void MainUI::goToDevice(QAction *act){
if(act==ui->actionScan){
RebuildDeviceMenu();
}else{
- setCurrentDir(act->whatsThis());
+ //setCurrentDir(act->whatsThis());
}
}
void MainUI::viewModeChanged(bool active){
- if(!active){ return; } //on every view change, all 3 radio buttons will call this function - only run this once though
- if(radio_view_details->isChecked()){
- ui->tree_dir_view->setVisible(true);
- ui->list_dir_view->setVisible(false);
- settings->setValue("viewmode","details");
- }else if(radio_view_list->isChecked()){
- ui->tree_dir_view->setVisible(false);
- ui->list_dir_view->setVisible(true);
- ui->list_dir_view->setViewMode( QListView::ListMode );
- ui->list_dir_view->setUniformItemSizes(false);
- ui->list_dir_view->setIconSize( QSize(20,20) );
- settings->setValue("viewmode","list");
- }else{ //icons
- ui->tree_dir_view->setVisible(false);
- ui->list_dir_view->setVisible(true);
- ui->list_dir_view->setViewMode( QListView::IconMode );
- ui->list_dir_view->setUniformItemSizes(true);
- ui->list_dir_view->setIconSize( QSize(90,64) );
- settings->setValue("viewmode","icons");
+ if(!active){ return; } //on every view change, all radio buttons will call this function - only run this once though
+ bool showDetails = radio_view_details->isChecked();
+ if(showDetails){ settings->setValue("viewmode","details"); }
+ else{ settings->setValue("viewmode","list"); }
+
+ //Re-load the view widgets
+ for(int i=0; i<DWLIST.length(); i++){
+ DWLIST[i]->setShowDetails(showDetails);
}
- //Re-load the view widget
- setCurrentDir(getCurrentDir());
}
-//-----------------------
-//Toolbar Actions
-//-----------------------
-void MainUI::on_actionBack_triggered(){
- QStringList history = tabBar->tabData(tabBar->currentIndex()).toStringList();
- if(history.length() <= 1){ return; } //need the second item
- history.removeAt(0); //remove the first item (the current dir)
- tabBar->setTabData(tabBar->currentIndex(), history); //re-write the saved history
- setCurrentDir(history.first()); //go to the previous entry in the history
+void MainUI::groupModeChanged(bool active){
+ if(!active){ return; } //on every change, all radio buttons will call this function - only run this once though
+ bool usetabs = radio_view_tabs->isChecked();
+ if(usetabs){
+ settings->setValue("groupmode","tabs");
+ //Now clean up all the tabs (remove the generic one and add the specific ones)
+ for(int i=0; i<tabBar->count(); i++){
+ //Remove all the browser tabs
+ if( !tabBar->tabWhatsThis(i).startsWith("#") ){
+ tabBar->removeTab(i);
+ i--; //go back one to ensure nothing is missed
+ }
+ }
+ //Create all the specific browser tabs for open browsers
+ for(int i=0; i<DWLIST.length(); i++){
+ qDebug() << "Add specific tab:" << DWLIST[i]->currentDir() << DWLIST[i]->id();
+ int tab = tabBar->addTab( LXDG::findIcon("folder-open",""), DWLIST[i]->currentDir().section("/",-1) );
+ tabBar->setTabWhatsThis(tab, DWLIST[i]->id() );
+ DWLIST[i]->setShowCloseButton(false);
+ }
+ }else{
+ settings->setValue("groupmode","columns");
+ //Now clean up the tabs (remove the specific ones and add a generic one)
+ for(int i=0; i<tabBar->count(); i++){
+ //Remove all the browser tabs
+ if( !tabBar->tabWhatsThis(i).startsWith("#") ){
+ tabBar->removeTab(i);
+ i--; //go back one to ensure nothing is missed
+ }
+ }
+ //Now create the generic "browser" tab
+ int tab = tabBar->addTab( LXDG::findIcon("folder-open",""), tr("Browser") );
+ tabBar->setTabWhatsThis(tab, "Browser" );
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->setShowCloseButton(true); }
+ }
+ if(tabBar->currentIndex()<0){ tabBar->setCurrentIndex(0); }
+ tabBar->setVisible( tabBar->count() > 1 );
+ QTimer::singleShot(20, this, SLOT(tabChanged()) );
}
-void MainUI::on_actionUpDir_triggered(){
- QString dir = getCurrentDir();
- dir.chop( dir.section("/",-1).length() );
- setCurrentDir(dir);
+void MainUI::on_actionLarger_Icons_triggered(){
+ int size = settings->value("iconsize", 32).toInt();
+ size += 16;
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->setThumbnailSize(size); }
+ settings->setValue("iconsize", size);
}
-void MainUI::on_actionHome_triggered(){
- setCurrentDir(QDir::homePath());
+void MainUI::on_actionSmaller_Icons_triggered(){
+ int size = settings->value("iconsize", 32).toInt();
+ if(size <= 16){ return; }
+ size -= 16;
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->setThumbnailSize(size); }
+ settings->setValue("iconsize", size);
}
-void MainUI::on_actionBookMark_triggered(){
+/*void MainUI::on_actionBookMark_triggered(){
QString dir = getCurrentDir();
bool ok = false;
QString name = QInputDialog::getText(this, tr("New Bookmark"), tr("Name:"), QLineEdit::Normal, dir, \
@@ -819,104 +481,47 @@ void MainUI::on_actionBookMark_triggered(){
//Now rebuild the bookmarks menu
RebuildBookmarksMenu();
ui->actionBookMark->setEnabled(false); //already bookmarked
-}
-
-//-----------------------------
-//Browser Functions
-//-----------------------------
-void MainUI::startEditDir(QWidget *old, QWidget *now){
- if(now==currentDir){
- //The dir edit just got focus
- QString dir = currentDir->text();
- dir.replace("~/", QDir::homePath()+"/");
- currentDir->setText(dir);
- //Try to move to the end
- currentDir->selectAll();
- }else if(old==currentDir){
- QString dir = currentDir->text();
- setCurrentDir(dir);
- }
-}
-
-void MainUI::goToDirectory(){
- QString dir = currentDir->text();
- dir.replace("~/",QDir::homePath()+"/");
- setCurrentDir(dir);
-}
-
-void MainUI::reloadDirectory(){
- setCurrentDir( getCurrentDir() );
-}
-
-/*void MainUI::viewportChanged(){
- if( !ui->actionsShow_Thumbnails->isChecked()){ return; }
- QModelIndexList list = getVisibleItems();
- for(int i=0; i<list.length(); i++){
- if( !ui->actionsShow_Thumbnails->isChecked()){ return; } //break out as necessary
- if( imgFilter.contains("*."+fsmod->filePath(list[i]).section("/",-1).section(".",-1).toLower()){
- fmod->
- }
- }
}*/
-void MainUI::currentDirectoryLoaded(){
- //The directory was just loaded: refresh the action buttons as neccesary
- // NOTE: This is only "caught" when a *new* directory is loaded into the model
- ui->tool_goToPlayer->setVisible(false);
- ui->tool_goToRestore->setVisible(false);
- ui->tool_goToImages->setVisible(false);
- emit DirChanged(getCurrentDir());
- emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Folders"), tr("Files"));
- ItemSelectionChanged();
-}
-
-void MainUI::on_tool_addToDir_clicked(){
- bool ok = false;
- QString newdir = QInputDialog::getText(this, tr("New Directory"), tr("Name:"), QLineEdit::Normal, "", \
- &ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly);
- if(!ok || newdir.isEmpty()){ return; }
- QString full = getCurrentDir();
- if(!full.endsWith("/")){ full.append("/"); }
- QDir dir(full); //open the current dir
- full.append(newdir); //append the new name to the current dir
- //Verify that the new dir does not already exist
- if(dir.exists(full)){
- QMessageBox::warning(this, tr("Invalid Name"), tr("A file or directory with that name already exists! Please pick a different name."));
- QTimer::singleShot(0,this, SLOT(on_tool_addToDir_clicked()) ); //repeat this function
- }else{
- if(!dir.mkdir(newdir) ){
- QMessageBox::warning(this, tr("Error Creating Directory"), tr("The directory could not be created. Please ensure that you have the proper permissions to modify the current directory."));
- }
- }
-}
-
-void MainUI::on_tool_addNewFile_clicked(){
- bool ok = false;
- QString newdocument = QInputDialog::getText(this, tr("New Document"), tr("Name:"), QLineEdit::Normal, "", \
- &ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly);
- if(!ok || newdocument.isEmpty()){ return; }
- QString full = getCurrentDir();
- if(!full.endsWith("/")){ full.append("/"); }
- QFile file(full+newdocument);
- if(file.open(QIODevice::ReadWrite)){
- //If successfully opened, it has created a blank file
- file.close();
- }else{
- QMessageBox::warning(this, tr("Error Creating Document"), tr("The document could not be created. Please ensure that you have the proper permissions."));
- }
-
-}
-
void MainUI::tabChanged(int tab){
+ if(tab<0){ tab = tabBar->currentIndex(); }
+ if(tab < 0){ return; }
//Load the directory contained in the new tab
- qDebug() << "Change to Tab:" << tab << tabBar->tabText(tab);
- QString dir = tabBar->tabWhatsThis(tab); //get the full directory
- setCurrentDir(dir); //display this as the current dir
+ QString info = tabBar->tabWhatsThis(tab); //get the full directory
+ if(info.isEmpty()){ return; } //unknown tab (this happens while we are in the middle of making changes to tabs - just ignore it)
+ //qDebug() << "Change to Tab:" << tab << tabBar->tabText(tab);
+ //qDebug() << " -- ID:" << info;
+ if(info=="#MW"){ ui->stackedWidget->setCurrentWidget(ui->page_player); }
+ else if(info=="#SW"){ ui->stackedWidget->setCurrentWidget(ui->page_image); }
+ else{
+ ui->stackedWidget->setCurrentWidget(ui->page_browser);
+ if(radio_view_tabs->isChecked()){
+ for(int i=0; i<DWLIST.length(); i++){
+ DWLIST[i]->setVisible(DWLIST[i]->id()==info);
+ }
+ }else{
+ //For columns, all widgets need to be visible
+ for(int i=0; i<DWLIST.length(); i++){
+ DWLIST[i]->setVisible(true);
+ }
+ }
+ }
+ tabBar->setVisible( tabBar->count() > 1 );
}
void MainUI::tabClosed(int tab){
if(tabBar->count()==1){ return; } //Can't close the only tab
if(tab < 0){ tab = tabBar->currentIndex(); }
+ QString info = tabBar->tabWhatsThis(tab);
+ if(!info.startsWith("#")){
+ if(DWLIST.length()<2){ return; }
+ for(int i=0; i<DWLIST.length(); i++){
+ if(info == DWLIST[i]->id()){
+ delete DWLIST.takeAt(i);
+ break;
+ }
+ }
+ }
//Remove the tab (will automatically move to a different one);
qDebug() << "Closing tab:" << tab << tabBar->tabText(tab);
tabBar->removeTab(tab);
@@ -935,512 +540,72 @@ void MainUI::nextTab(){
else{ tabBar->setCurrentIndex( cur+1 ); }
}
-void MainUI::ItemRun(const QModelIndex &index){
- //This is called when the user double clicks a file/directory
- QString val = fsmod->filePath(index).section("/",-1);
- QString itemPath = getCurrentDir();
- if( !itemPath.endsWith("/")){ itemPath.append("/"); }
- itemPath.append(val);
- if(fsmod->isDir(index)){
- setCurrentDir( itemPath );
- }else{
- //Must be a file, try to run it
- QProcess::startDetached("lumina-open \""+itemPath+"\"");
- }
-}
-
-void MainUI::OpenContextMenu(const QPoint &pt){
- QFileInfo info;
- if(radio_view_details->isChecked()){
- QModelIndex it = ui->tree_dir_view->indexAt(pt);
- if(!it.isValid()){ CItem.clear();}
- else{
- info = fsmod->fileInfo(it);
- CItem = info.absoluteFilePath();
- }
- }else{
- QModelIndex it = ui->list_dir_view->indexAt(pt);
- if(!it.isValid()){ CItem.clear();}
- else{
- info = fsmod->fileInfo(it);
- CItem = info.absoluteFilePath();
+void MainUI::DirDataAvailable(QString id, QString dir, LFileInfoList list){
+ for(int i=0; i<DWLIST.length(); i++){
+ if(id == DWLIST[i]->id()){
+ DWLIST[i]->LoadDir(dir, list);
+ break;
}
}
- //Create the context menu
- contextMenu->clear();
- if(!CItem.isEmpty()){
- contextMenu->addAction(LXDG::findIcon("run-build-file",""), tr("Open"), this, SLOT(OpenItem()) );
- contextMenu->addAction(LXDG::findIcon("run-build-configure",""), tr("Open With..."), this, SLOT(OpenItemWith()) );
-
- contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename"), this, SLOT(RenameItem()) )->setEnabled(info.isWritable());
- contextMenu->addAction(LXDG::findIcon("document-encrypted",""), tr("View Checksums"), this, SLOT(ChecksumItems()) );
- contextMenu->addSeparator();
- }
- bool hasSelection = !getSelectedItems().isEmpty();
- //Now add the general selection options
- contextMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(CutItems()) )->setEnabled(info.isWritable() && hasSelection);
- contextMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(CopyItems()) )->setEnabled(hasSelection);
- contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(PasteItems()) )->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && isUserWritable);
- contextMenu->addSeparator();
- contextMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(RemoveItem()) )->setEnabled(info.isWritable()&&hasSelection);
- if(LUtils::isValidBinary("lumina-fileinfo")){
- contextMenu->addSeparator();
- contextMenu->addAction(LXDG::findIcon("edit-find-replace",""), tr("File Properties"), this, SLOT(ViewPropertiesItem()) )->setEnabled(hasSelection);
- }
- if (info.isDir() || CItem.isEmpty()) {
- //in case the user click on a directory or click on the background
- contextMenu->addSeparator();
- contextMenu->addAction(LXDG::findIcon("system-search",""), tr("Open Terminal here"), this, SLOT(openTerminal()));
- }
- //Now show the menu
- if(radio_view_details->isChecked()){
- contextMenu->popup(ui->tree_dir_view->mapToGlobal(pt));
- }else{
- contextMenu->popup(ui->list_dir_view->mapToGlobal(pt));
- }
-}
-
-void MainUI::ItemSelectionChanged(){
- //Enable/disable the action buttons
- QFileInfoList sel = getSelectedItems();
- //display info related to files selected.
- //TO CHECK: impact if filesystem is very slow
- if(sel.size()>0){ emit Si_AdaptStatusBar(sel, "", tr("Selected Folders"), tr("Files"));}
- else{ emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Folders"), tr("Files")); }
-
- ui->tool_act_run->setEnabled(!sel.isEmpty());
- ui->tool_act_runwith->setEnabled(!sel.isEmpty());
- ui->tool_act_rm->setEnabled(!sel.isEmpty() && isUserWritable);
- ui->tool_act_rename->setEnabled(sel.length()==1 && isUserWritable);
- ui->tool_act_cut->setEnabled(!sel.isEmpty() && isUserWritable);
- ui->tool_act_copy->setEnabled(!sel.isEmpty());
- ui->tool_act_paste->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && isUserWritable);
- if(ui->tool_act_paste->isEnabled()){
- ui->tool_act_paste->setToolTip( QString(tr("Currently on clipboard:\n%1")).arg( QString(QApplication::clipboard()->mimeData()->data("x-special/lumina-copied-files")).replace("::::",": ") ) );
- }else{
- ui->tool_act_paste->setToolTip("");
- }
- QString itname;
- if(sel.length()==1){ itname = sel[0].fileName(); }
- bool ok = !itname.isEmpty() && (getCurrentDir()!=QDir::homePath()+"/Desktop");
- if(ok){
- ok = !LUtils::isFavorite(sel[0].canonicalFilePath());
- }
- ui->tool_act_fav->setEnabled(ok);
-}
-
-//-------------------------------
-//Slideshow Functions
-//-------------------------------
-void MainUI::showNewPicture(){
- if( !ui->label_image->isVisible() ){ return; } //don't update if not visible - can cause strange resizing issues
- QString file = getCurrentDir();
- if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());
- //qDebug() << "Show Image:" << file;
- QPixmap pix(file);
- if(pix.size().width() > ui->label_image->contentsRect().width() || pix.size().height() > ui->label_image->contentsRect().height()){
- pix = pix.scaled(ui->label_image->contentsRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
- }
- ui->label_image->setPixmap(pix);
- //Now set/load the buttons
- ui->tool_image_goBegin->setEnabled(ui->combo_image_name->currentIndex()>0);
- ui->tool_image_goPrev->setEnabled(ui->combo_image_name->currentIndex()>0);
- ui->tool_image_goEnd->setEnabled(ui->combo_image_name->currentIndex()<(ui->combo_image_name->count()-1));
- ui->tool_image_goNext->setEnabled(ui->combo_image_name->currentIndex()<(ui->combo_image_name->count()-1));
- ui->label_image_index->setText( QString::number(ui->combo_image_name->currentIndex()+1)+"/"+QString::number(ui->combo_image_name->count()) );
- static QList<QByteArray> writeableformats;
- if(writeableformats.isEmpty()){
- writeableformats = QImageWriter::supportedImageFormats();
- qDebug() << "Writeable image formats:" << writeableformats;
- }
- bool canwrite = writeableformats.contains(file.section(".",-1).toLower().toLocal8Bit()); //compare the suffix with the list
- ui->tool_image_remove->setEnabled(isUserWritable);
- ui->tool_image_rotateleft->setEnabled(isUserWritable && canwrite);
- ui->tool_image_rotateright->setEnabled(isUserWritable && canwrite);
-}
-
-void MainUI::firstPicture(){
- ui->combo_image_name->setCurrentIndex(0);
-}
-
-void MainUI::prevPicture(){
- ui->combo_image_name->setCurrentIndex( ui->combo_image_name->currentIndex()-1 );
-}
-
-void MainUI::nextPicture(){
- ui->combo_image_name->setCurrentIndex( ui->combo_image_name->currentIndex()+1 );
-}
-
-void MainUI::lastPicture(){
- ui->combo_image_name->setCurrentIndex( ui->combo_image_name->count()-1 );
-}
-
-void MainUI::removePicture(){
- QString file = getCurrentDir();
- if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());
- //Verify permanent removal of file/dir
- if(QMessageBox::Yes != QMessageBox::question(this, tr("Verify Removal"), tr("WARNING: This will permanently delete the file from the system!")+"\n"+tr("Are you sure you want to continue?")+"\n\n"+file, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
- return; //cancelled
- }
- if( QFile::remove(file) ){
- int index = ui->combo_image_name->currentIndex();
- ui->combo_image_name->removeItem( index );
- }
-}
-
-void MainUI::rotatePictureLeft(){
- //First load the file fresh (not the scaled version in the UI)
- QString file = getCurrentDir();
- if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());
- QPixmap pix(file);
- //Now rotate the image 90 degrees counter-clockwise
- QTransform trans;
- pix = pix.transformed( trans.rotate(-90) , Qt::SmoothTransformation);
- //Now save the image back to the same file
- pix.save(file);
- //Now re-load the image in the UI
- showNewPicture();
-}
-
-void MainUI::rotatePictureRight(){
- //First load the file fresh (not the scaled version in the UI)
- QString file = getCurrentDir();
- if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());
- QPixmap pix(file);
- //Now rotate the image 90 degrees counter-clockwise
- QTransform trans;
- pix = pix.transformed( trans.rotate(90) , Qt::SmoothTransformation);
- //Now save the image back to the same file
- pix.save(file);
- //Now re-load the image in the UI
- showNewPicture();
-}
-
-//----------------------------------
-//ZFS Restore Functions
-//----------------------------------
-void MainUI::snapshotLoaded(){
- ui->tree_zfs_dir->resizeColumnToContents(0);
-}
-
-void MainUI::showSnapshot(){
- ui->tool_zfs_prevSnap->setEnabled(ui->slider_zfs_snapshot->value()!=1);
- ui->tool_zfs_nextSnap->setEnabled(ui->slider_zfs_snapshot->value()!=ui->slider_zfs_snapshot->maximum());
- ui->label_zfs_snap->setText( snapDirs[ui->slider_zfs_snapshot->value()-1].section("/.zfs/snapshot/",1,1).section("/",0,0) );
- //Load the dir contents
- ui->tree_zfs_dir->setRootIndex(snapmod->index(snapDirs[ui->slider_zfs_snapshot->value()-1]));
-}
-
-void MainUI::prevSnapshot(){
- ui->slider_zfs_snapshot->setValue(ui->slider_zfs_snapshot->value()-1);
-}
-
-void MainUI::nextSnapshot(){
- ui->slider_zfs_snapshot->setValue(ui->slider_zfs_snapshot->value()+1);
-}
-
-void MainUI::restoreItems(){
- //Get the selected items
- QStringList sel; //= getSelectedItems();
- QModelIndexList items = ui->tree_zfs_dir->selectionModel()->selectedIndexes();
- for(int i=0; i<items.length(); i++){
- sel << snapmod->filePath(items[i]).section("/",-1);
- }
- sel.removeDuplicates();
- if(sel.isEmpty()){ return; } //nothing selected
- if(!checkUserPerms()){ return; }
- //Get the directories
- QString snapdir = snapDirs[ui->slider_zfs_snapshot->value()-1];
- QString basedir = getCurrentDir();
- if(!basedir.endsWith("/")){ basedir.append("/"); }
- if(!snapdir.endsWith("/")){ snapdir.append("/"); }
- //Fill out the lists appropriately
- QStringList resto;
- qDebug() << "Items Selected:" << sel;
- for(int i=0; i<sel.length(); i++){
- resto << basedir+sel[i];
- sel[i] = snapdir+sel[i];
- }
- qDebug() << "Restore Items:" << sel << "\n" << resto;
- //Restore the items
- FODialog dlg(this);
- dlg.setOverwrite(ui->check_zfs_overwrite->isChecked());
- dlg.RestoreFiles(sel, resto);
- dlg.exec();
- if(dlg.noerrors){
- QMessageBox::information(this, tr("Success"), tr("Successfully restored selection") );
- }
-}
-
-//----------------------------
-// Multimedia Player
-//----------------------------
-void MainUI::playerStart(){
- if(ui->stackedWidget->currentWidget()!=ui->page_audioPlayer){ return; } //don't play if not in the player
-
- if(mediaObj->state()==QMediaPlayer::PausedState \
- && mediaObj->currentMedia().canonicalUrl().fileName()==ui->combo_player_list->currentText() ){
- mediaObj->play();
- }else{
- mediaObj->stop();
- //Get the selected file path
- QString filePath = getCurrentDir();
- if(!filePath.endsWith("/")){ filePath.append("/"); }
- filePath.append( ui->combo_player_list->currentText() );
- mediaObj->setMedia( QUrl::fromLocalFile(filePath) );
- playerTTime.clear();
- playerSlider->setEnabled(mediaObj->isSeekable());
- mediaObj->play();
- }
-}
-
-void MainUI::playerError(){
- QString msg = QString(tr("Error Playing File: %1"));
- msg = msg.arg( mediaObj->currentMedia().canonicalUrl().fileName() );
- msg.append("\n"+mediaObj->errorString());
- ui->label_player_novideo->setText(msg);
-}
-
-void MainUI::playerStop(){
- mediaObj->stop();
-}
-
-void MainUI::playerPause(){
- mediaObj->pause();
-}
-
-void MainUI::playerNext(){
- ui->combo_player_list->setCurrentIndex( ui->combo_player_list->currentIndex()+1);
- if(mediaObj->state()!=QMediaPlayer::StoppedState){ playerStart(); }
-}
-
-void MainUI::playerPrevious(){
- ui->combo_player_list->setCurrentIndex( ui->combo_player_list->currentIndex()-1);
- if(mediaObj->state()!=QMediaPlayer::StoppedState){ playerStart(); }
-}
-
-void MainUI::playerFinished(){
- if(ui->combo_player_list->currentIndex()<(ui->combo_player_list->count()-1) && ui->check_player_gotonext->isChecked()){
- ui->combo_player_list->setCurrentIndex( ui->combo_player_list->currentIndex()+1 );
- QTimer::singleShot(0,this,SLOT(playerStart()));
- }else{
- ui->label_player_novideo->setText(tr("Finished"));
- }
-}
-
-void MainUI::playerStatusChanged(QMediaPlayer::MediaStatus stat){
- //Only use this for end-of-file detection - use the state detection otherwise
- if(stat == QMediaPlayer::EndOfMedia){
- if(!mediaObj->isMuted()){ playerFinished(); } //make sure it is not being seeked right now
- }
-}
-
-void MainUI::playerStateChanged(QMediaPlayer::State newstate){
- //This function keeps track of updating the visuals of the player
- bool running = false;
- bool showVideo = false;
- QString msg;
- switch(newstate){
- case QMediaPlayer::PlayingState:
- running=true;
- showVideo = mediaObj->isVideoAvailable();
- msg = "";//mediaObj->metaData(Phonon::TitleMetaData).join(" ");
- if(msg.simplified().isEmpty()){ msg = ui->combo_player_list->currentText(); }
- ui->label_player_novideo->setText(tr("Playing:")+"\n"+msg);
- break;
- case QMediaPlayer::PausedState:
- showVideo=videoDisplay->isVisible(); //don't change the screen
- break;
- case QMediaPlayer::StoppedState:
- ui->label_player_novideo->setText(tr("Stopped"));
- break;
- }
- ui->tool_player_play->setVisible(!running);
- ui->tool_player_pause->setVisible(running);
- ui->tool_player_stop->setEnabled(running);
- ui->label_player_novideo->setVisible(!showVideo);
- videoDisplay->setVisible(showVideo);
-}
-
-void MainUI::playerVideoAvailable(bool showVideo){
- ui->label_player_novideo->setVisible(!showVideo);
- videoDisplay->setVisible(showVideo);
-}
-
-void MainUI::playerDurationChanged(qint64 dur){
- if(dur < 0){ return; } //not ready yet
- playerSlider->setMaximum(mediaObj->duration());
- playerTTime = msToText(dur);
-}
-
-void MainUI::playerTimeChanged(qint64 ctime){
- if(mediaObj->isMuted() || playerTTime.isEmpty() ){ return; } //currently being moved
- playerSlider->setSliderPosition(ctime);
-}
-
-void MainUI::playerSliderMoved(int val){
- ui->label_player_runstats->setText( msToText(val)+"/"+playerTTime );
- if(mediaObj->isMuted()){ mediaObj->setPosition(playerSlider->value()); } //currently seeking
-}
-
-void MainUI::playerSliderHeld(){
- mediaObj->setMuted(true);
- mediaObj->pause();
-}
-void MainUI::playerSliderChanged(){
- if(mediaObj->state()==QMediaPlayer::PausedState){ mediaObj->play(); }
- mediaObj->setMuted(false);
-}
-
-void MainUI::playerFileChanged(){
- ui->tool_player_next->setEnabled( ui->combo_player_list->count() > (ui->combo_player_list->currentIndex()+1) );
- ui->tool_player_prev->setEnabled( (ui->combo_player_list->currentIndex()-1) >= 0 );
-}
-
-//----------------------------------
-// Context Menu Actions
-//----------------------------------
-void MainUI::OpenItem(){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
-
- QStringList dirs;
- for(int i=0; i<sel.length(); i++){
- if(sel[i].isDir()){ dirs << sel[i].absoluteFilePath(); }
- else{
- qDebug() << "Opening File:" << sel[i].absoluteFilePath();
- QProcess::startDetached("lumina-open \""+sel[i].absoluteFilePath()+"\"");
+ if(radio_view_tabs->isChecked()){
+ //Need to update the text for the tab so it corresponds to the current directory loaded
+ for(int i=0; i<tabBar->count(); i++){
+ if(tabBar->tabWhatsThis(i)==id){
+ tabBar->setTabText(i, dir.section("/",-1));
+ }
}
}
- if(!dirs.isEmpty()){ OpenDirs(dirs); }
- CItem.clear();
}
-void MainUI::OpenItemWith(){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){
- qDebug() << "Opening File With:" << sel[i].absoluteFilePath();
- QProcess::startDetached("lumina-open -select \""+sel[i].absoluteFilePath()+"\"");
+void MainUI::SnapshotDataAvailable(QString id , QString dir, QStringList list){
+ for(int i=0; i<DWLIST.length(); i++){
+ if(id == DWLIST[i]->id()){
+ DWLIST[i]->LoadSnaps(dir, list);
+ break;
+ }
}
- CItem.clear();
}
-/*void MainUI::OpenDir(){
- if(CItem.isEmpty()){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- else{ CItem = sel[0].absoluteFilePath(); }
+void MainUI::OpenPlayer(LFileInfoList list){
+ //See if the tab is available for the multimedia player
+ int tab = -1;
+ for(int i=0; i<tabBar->count(); i++){
+ if(tabBar->tabWhatsThis(i)=="#MW"){ tab=i; break;}
}
- OpenDirs(QStringList() << CItem);
- CItem.clear();
-}*/
-
-void MainUI::RemoveItem(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- if(!checkUserPerms()){ return; }
- //Get the selected items
- QStringList paths, names;
- //if(CItem.isEmpty()){
- QFileInfoList sel = getSelectedItems();
- for(int i=0; i<sel.length(); i++){
- paths << sel[i].absoluteFilePath();
- names << sel[i].fileName();
- }
- if(sel.isEmpty()){ return; } //nothing selected
- /*}else{
- paths << CItem;
- names << CItem.section("/",-1);
- }*/
- //Verify permanent removal of file/dir
- if(QMessageBox::Yes != QMessageBox::question(this, tr("Verify Removal"), tr("WARNING: This will permanently delete the file(s) from the system!")+"\n"+tr("Are you sure you want to continue?")+"\n\n"+names.join("\n"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
- return; //cancelled
+ if(tab<0){
+ //Need to create a new tab
+ tab = tabBar->addTab(LXDG::findIcon("media-playback-start",""), tr("Multimedia"));
+ tabBar->setTabWhatsThis(tab,"#MW");
+ //Also clear the info in the player
+ MW->ClearPlaylist();
}
- //Now remove the file/dir
- qDebug() << "Delete: "<<paths;
- FODialog dlg(this);
- dlg.RemoveFiles(paths);
- dlg.show();
- dlg.exec();
- CItem.clear();
+ //Load the data into the player
+ MW->LoadMultimedia(list);
+ //Switch to the player tab
+ tabBar->setCurrentIndex(tab);
}
-void MainUI::RenameItem(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- if(!checkUserPerms()){ return; }
- if(CItem.isEmpty()){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- else{ CItem = sel[0].absoluteFilePath(); }
+void MainUI::OpenImages(LFileInfoList list){
+ int tab = -1;
+ for(int i=0; i<tabBar->count(); i++){
+ if(tabBar->tabWhatsThis(i)=="#SW"){ tab=i; break;}
}
- QString fname = CItem;
- QString path = fname;
- fname = fname.section("/",-1); //turn this into just the file name
- path.chop(fname.length()); //turn this into the base directory path (has a "/" at the end)
- //Now prompt for the new filename
- bool ok = false;
- QString nname = QInputDialog::getText(this, tr("Rename File"),tr("New Name:"), QLineEdit::Normal, fname, &ok);
- if(!ok || nname.isEmpty()){ CItem.clear(); return; } //cancelled
- //Now check for a file extension and add it if necessary
- QString oext = fname.section(".",-1);
- if("."+oext == fname){ oext.clear(); } //hidden file without an extension
- else if(oext==fname){ oext.clear(); } //no extension
- QString next = nname.section(".",-1);
- if(next==nname){ next.clear(); } //no extension
- if(next.isEmpty() && !oext.isEmpty()){
- nname.append( "."+oext );
- }
- //Check if this filename already exists
- bool overwrite = QFile::exists(path+nname);
- if(overwrite){
- if(QMessageBox::Yes != QMessageBox::question(this, tr("Overwrite File?"), tr("An existing file with the same name will be replaced. Are you sure you want to proceed?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
- CItem.clear(); return; //cancelled
- }
+ if(tab<0){
+ //Need to create a new tab
+ tab = tabBar->addTab(LXDG::findIcon("fileview-preview",""), tr("Slideshow"));
+ tabBar->setTabWhatsThis(tab,"#SW");
+ //Also clear the info in the viewer
+ SW->ClearImages();
}
- //Now perform the move
- qDebug() << "Rename:" << path+fname << "->" << path+nname;
- FODialog dlg(this);
- dlg.setOverwrite(overwrite);
- dlg.MoveFiles(QStringList() << path+fname, QStringList() << path+nname);
- dlg.show();
- dlg.exec();
- CItem.clear();
-
- ItemSelectionChanged();
+ //Load the data into the viewer
+ SW->LoadImages(list);
+ //Switch to the player tab
+ tabBar->setCurrentIndex(tab);
+ QTimer::singleShot(20, SW, SLOT(refresh()) );
}
-void MainUI::FavoriteItem(){
- if(CItem.isEmpty()){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- else{ CItem = sel[0].canonicalFilePath(); }
- }
- //QString fname = CItem;
- QString fullpath = CItem;
- /*fname = fname.section("/",-1); //turn this into just the file name
- if(QFile::exists(favdir+fname)){ QFile::remove(favdir+fname); } //remove the stale link
- QFile::link(fullpath, favdir+fname);*/
- LUtils::addFavorite(fullpath);
- CItem.clear();
- ItemSelectionChanged();
-}
-
-void MainUI::ViewPropertiesItem(){
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- for(int i=0; i<sel.length(); i++){
- QProcess::startDetached("lumina-fileinfo \""+sel[i].absoluteFilePath()+"\"");
- }
-}
-
-void MainUI::openTerminal(){
- QFileInfoList sel = getSelectedItems();
+void MainUI::OpenTerminal(QString dirpath){
+ //QFileInfoList sel = getSelectedItems();
QString shell;
//we get the shell has defined in the environment
if (getenv("SHELL")) shell = QString(getenv("SHELL"));
@@ -1460,78 +625,61 @@ void MainUI::openTerminal(){
//The binary does not exist or is invalid
defTerminal = "xterm";
}
- if(sel.isEmpty()){
+
//-e is the parameter for most of the terminal appliction to execute an external command.
//In your case we start a shell in the selected directory
- QProcess::startDetached(defTerminal + " -e \"cd " + getCurrentDir() + " && " + shell + " \" ");
- } else {
- QProcess::startDetached(defTerminal + " -e \"cd " + sel[0].absoluteFilePath() + " && " + shell + " \" ");
- }
-}
+ QProcess::startDetached(defTerminal + " -e \"cd " + dirpath + " && " + shell + " \" ");
+}
-void MainUI::CutItems(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- if(!checkUserPerms()){ return; }
- //Get all the selected Items
- QFileInfoList sel = getSelectedItems();
- QStringList items;
- if(sel.isEmpty()){ return; } //nothing selected
+void MainUI::CutFiles(QStringList list){
+ qDebug() << "Cut Files:" << list;
+ if(list.isEmpty()){ return; } //nothing selected
//Format the data string
- for(int i=0; i<sel.length(); i++){
- items << "cut::::"+sel[i].absoluteFilePath();
- //sel[i] = sel[i].prepend("cut::::");
+ for(int i=0; i<list.length(); i++){
+ list[i] = list[i].prepend("cut::::");
}
-
//Now save that data to the global clipboard
QMimeData *dat = new QMimeData;
dat->clear();
- dat->setData("x-special/lumina-copied-files", items.join("\n").toLocal8Bit());
+ dat->setData("x-special/lumina-copied-files", list.join("\n").toLocal8Bit());
QApplication::clipboard()->clear();
QApplication::clipboard()->setMimeData(dat);
- ItemSelectionChanged();
+ //Update all the buttons to account for clipboard change
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->refreshButtons(); }
}
-void MainUI::CopyItems(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- //Get all the selected Items
- QFileInfoList sel = getSelectedItems();
- QStringList items;
- if(sel.isEmpty()){ return; } //nothing selected
+void MainUI::CopyFiles(QStringList list){
+ qDebug() << "Copy Files:" << list;
+ if(list.isEmpty()){ return; } //nothing selected
//Format the data string
- for(int i=0; i<sel.length(); i++){
- items << "copy::::"+sel[i].absoluteFilePath();
- //sel[i] = sel[i].prepend("copy::::");
+ for(int i=0; i<list.length(); i++){
+ list[i] = list[i].prepend("copy::::");
}
//Now save that data to the global clipboard
QMimeData *dat = new QMimeData;
dat->clear();
- dat->setData("x-special/lumina-copied-files", items.join("\n").toLocal8Bit());
+ dat->setData("x-special/lumina-copied-files", list.join("\n").toLocal8Bit());
QApplication::clipboard()->clear();
- QApplication::clipboard()->setMimeData(dat);
- ItemSelectionChanged();
+ QApplication::clipboard()->setMimeData(dat);
+ //Update all the buttons to account for clipboard change
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->refreshButtons(); }
}
-void MainUI::PasteItems(){
- //Only let this run if viewing the browser page
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- const QMimeData *dat = QApplication::clipboard()->mimeData();
- if(!dat->hasFormat("x-special/lumina-copied-files")){ return; } //nothing to paste
- if(!checkUserPerms()){ return; }
+void MainUI::PasteFiles(QString dir){
+ qDebug() << "Paste Files:" << dir;
QStringList cut, copy, newcut, newcopy;
+ const QMimeData *dat = QApplication::clipboard()->mimeData();
QStringList raw = QString(dat->data("x-special/lumina-copied-files")).split("\n");
- QString base = getCurrentDir();
- if(!base.endsWith("/")){ base.append("/"); }
+ if(!dir.endsWith("/")){ dir.append("/"); }
for(int i=0; i<raw.length(); i++){
if(raw[i].startsWith("cut::::")){
cut << raw[i].section("::::",1,50);
- newcut << base+raw[i].section("::::",1,50).section("/",-1);
+ newcut << dir+raw[i].section("::::",1,50).section("/",-1);
}
else if(raw[i].startsWith("copy::::")){
copy << raw[i].section("::::",1,50);
- newcopy<< base+raw[i].section("::::",1,50).section("/",-1);
+ newcopy<< dir+raw[i].section("::::",1,50).section("/",-1);
}
}
bool errs = false;
@@ -1564,31 +712,94 @@ void MainUI::PasteItems(){
QApplication::clipboard()->setMimeData(dat);
}
}
- ItemSelectionChanged();
+ //Update all the buttons to account for clipboard change
+ for(int i=0; i<DWLIST.length(); i++){ DWLIST[i]->refreshButtons(); }
+}
+
+void MainUI::FavoriteFiles(QStringList list){
+ qDebug() << "Favorite Files:" << list;
+ for(int i=0; i<list.length(); i++){
+ LUtils::addFavorite(list[i]);
+ }
+ //Might want to make this a "toggle" instead of an add later on...
+}
+
+void MainUI::RenameFiles(QStringList list){
+ qDebug() << "Rename Files:" << list;
+ for(int i=0; i<list.length(); i++){
+ QString fname = list[i];
+ QString path = fname;
+ fname = fname.section("/",-1); //turn this into just the file name
+ path.chop(fname.length()); //turn this into the base directory path (has a "/" at the end)
+ //Now prompt for the new filename
+ bool ok = false;
+ QString nname = QInputDialog::getText(this, tr("Rename File"),tr("New Name:"), QLineEdit::Normal, fname, &ok);
+ if(!ok || nname.isEmpty()){ return; } //cancelled
+ //Now check for a file extension and add it if necessary
+ QString oext = fname.section(".",-1);
+ if("."+oext == fname){ oext.clear(); } //hidden file without an extension
+ else if(oext==fname){ oext.clear(); } //no extension
+ QString next = nname.section(".",-1);
+ if(next==nname){ next.clear(); } //no extension
+ if(next.isEmpty() && !oext.isEmpty()){
+ nname.append( "."+oext );
+ }
+ //Check if this filename already exists
+ bool overwrite = QFile::exists(path+nname);
+ if(overwrite){
+ if(QMessageBox::Yes != QMessageBox::question(this, tr("Overwrite File?"), tr("An existing file with the same name will be replaced. Are you sure you want to proceed?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
+ return; //cancelled
+ }
+ }
+ //Now perform the move
+ qDebug() << "Rename:" << path+fname << "->" << path+nname;
+ FODialog dlg(this);
+ dlg.setOverwrite(overwrite);
+ dlg.MoveFiles(QStringList() << path+fname, QStringList() << path+nname);
+ dlg.show();
+ dlg.exec();
+ } //end loop over list of files
+}
+
+void MainUI::RemoveFiles(QStringList list){
+ if(list.isEmpty()){ return; } //nothing selected
+ qDebug() << "Remove Files:" << list;
+ QStringList paths, names;
+ for(int i=0; i<list.length(); i++){
+ paths << list[i];
+ names << list[i].section("/",-1);
+ }
+
+ //Verify permanent removal of file/dir
+ if(QMessageBox::Yes != QMessageBox::question(this, tr("Verify Removal"), tr("WARNING: This will permanently delete the file(s) from the system!")+"\n"+tr("Are you sure you want to continue?")+"\n\n"+names.join("\n"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
+ return; //cancelled
+ }
+ //Now remove the file/dir
+ qDebug() << " - Delete: "<<paths;
+ FODialog dlg(this);
+ dlg.RemoveFiles(paths);
+ dlg.show();
+ dlg.exec();
}
-void MainUI::ChecksumItems(){
- if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; }
- QFileInfoList sel = getSelectedItems();
- if(sel.isEmpty()){ return; }
- QStringList info, files;
- for(int i=0; i<sel.length(); i++){
- files << sel[i].absoluteFilePath();
+void MainUI::CloseBrowser(QString ID){
+ if(DWLIST.length()<2){ return; } //cannot close the last browser
+ //Find the tab associated with this browser first
+ for(int i=0; i<tabBar->count(); i++){
+ if(tabBar->tabWhatsThis(i)==ID){
+ tabBar->removeTab(i);
+ break;
+ }
}
- qDebug() << "Run Checksums:" << files;
- 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]);
+ //Now remove the browser itself
+ for(int i=0; i<DWLIST.length(); i++){
+ if(DWLIST[i]->id()==ID){
+ delete DWLIST.takeAt(i);
+ break;
+ }
}
- /*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 MainUI::resizeEvent(QResizeEvent *event){
//Save the new size internally
diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h
index 6847f6f6..80582af6 100644
--- a/lumina-fm/MainUI.h
+++ b/lumina-fm/MainUI.h
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
+// Copyright (c) 2014-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -51,13 +51,11 @@
// Local includes
#include "FODialog.h" //file operation dialog
#include "BMMDialog.h" //bookmark manager dialog
-#include "MimeIconProvider.h" //icon provider for the view widgets
-#include "BackgroundWorker.h"
-#include "DDFileSystemModel.h"
#include "DirData.h"
#include "widgets/MultimediaWidget.h"
#include "widgets/SlideshowWidget.h"
+#include "widgets/DirWidget.h"
namespace Ui{
class MainUI;
@@ -69,42 +67,29 @@ public:
MainUI();
~MainUI();
- void OpenDirs(QStringList); //called from the main.cpp after initialization
-
public slots:
+ void OpenDirs(QStringList); //also called from the main.cpp after initialization
void setupIcons(); //used during initialization
private:
Ui::MainUI *ui;
QThread *workThread;
- BackgroundWorker *worker;
+ DirData *worker;
//Internal non-ui widgets
QTabBar *tabBar;
- QLineEdit *currentDir;
- DDFileSystemModel *fsmod;
- QFileSystemModel *snapmod;
- //QFileSystemWatcher *fswatcher;
- MimeIconProvider *iconProv;
+ QFileSystemModel *fsmod;
QMenu *contextMenu;
- QRadioButton *radio_view_details, *radio_view_list, *radio_view_icons;
- QWidgetAction *detWA, *listWA, *icoWA;
+ QRadioButton *radio_view_details, *radio_view_list, *radio_view_tabs, *radio_view_cols;
+ QWidgetAction *detWA, *listWA, *tabsWA, *colsWA;
QString favdir;
-
- //Phonon Widgets for the multimedia player
- QMediaPlayer *mediaObj;
- QVideoWidget *videoDisplay;
- QSlider *playerSlider;
- QString playerTTime; //total time - to prevent recalculation every tick
-
- //Internal variables
- QStringList snapDirs; //internal saved variable for the discovered zfs snapshot dirs
- QString CItem; //the item that was right-clicked (for the context menu)
- //QStringList imgFilter, multiFilter; //image/multimedia filters
+ //UI Widgets
+ QList<DirWidget*> DWLIST;
+ MultimediaWidget *MW;
+ SlideshowWidget *SW;
+
QSettings *settings;
- QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort, *copyFilesShort, *cutFilesShort, *pasteFilesShort, *deleteFilesShort;
+ QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort;
QCompleter *dirCompleter;
- bool isUserWritable, keepFocus;
- QTimer *syncTimer;
//Simplification Functions
void setupConnections(); //used during initialization
@@ -113,15 +98,6 @@ private:
void RebuildBookmarksMenu();
void RebuildDeviceMenu();
- bool checkUserPerms();
- QString msToText(qint64 ms);
-
- //Common functions for browser info/usage
- QString getCurrentDir();
- void setCurrentDir(QString);
- QFileInfoList getSelectedItems();
- //QModelIndexList getVisibleItems();
-
private slots:
void slotSingleInstance(QStringList in){
this->show();
@@ -129,18 +105,7 @@ private slots:
this->OpenDirs(in);
}
- void slotStartSyncTimer();
-
- //General button check functions (started in a seperate thread!)
- void AvailableMultimediaFiles(QStringList files);
- void AvailableBackups(QString basedir, QStringList snapdirs);
- void AvailablePictures(QStringList files);
-
- //General page switching
- void goToMultimediaPage();
- void goToRestorePage();
- void goToSlideshowPage();
- void goToBrowserPage();
+ //void slotStartSyncTimer();
//Menu Actions
void on_actionNew_Tab_triggered();
@@ -152,86 +117,36 @@ private slots:
void goToBookmark(QAction*);
void goToDevice(QAction*);
void viewModeChanged(bool);
-
- //Toolbar Actions
- void on_actionBack_triggered();
- void on_actionUpDir_triggered();
- void on_actionHome_triggered();
- void on_actionBookMark_triggered();
+ void groupModeChanged(bool);
+ void on_actionLarger_Icons_triggered();
+ void on_actionSmaller_Icons_triggered();
- //Browser Functions
- void startEditDir(QWidget *old, QWidget *now);
- void goToDirectory(); //go to a manually typed in directory
- void reloadDirectory(); //Update the widget with the dir contents
- void currentDirectoryLoaded(); //The file system model re-loaded the directory
- void on_tool_addToDir_clicked();
- void on_tool_addNewFile_clicked();
- void tabChanged(int tab);
+ //Tab interactions
+ void tabChanged(int tab = -1);
void tabClosed(int tab = -1);
- void prevTab();
- void nextTab();
- void ItemRun( const QModelIndex&);
- //void ItemRun(QTreeWidgetItem *item);
- //void ItemRun(QListWidgetItem *item);
- void OpenContextMenu(const QPoint&);
- void ItemSelectionChanged();
-
- //Slideshow Functions
- void showNewPicture();
- void firstPicture();
- void prevPicture();
- void nextPicture();
- void lastPicture();
- void removePicture();
- void rotatePictureLeft();
- void rotatePictureRight();
-
- //ZFS Restore Functions
- void snapshotLoaded();
- void showSnapshot();
- void nextSnapshot();
- void prevSnapshot();
- void restoreItems();
+ void nextTab(); //For keyboard shortcuts
+ void prevTab(); //For keyboard shortcuts
- //Multimedia Player Functions
- void playerStart();
- void playerError();
- void playerStop();
- void playerPause();
- void playerNext();
- void playerPrevious();
- void playerFinished(); //automatically called by the media object
- void playerStatusChanged(QMediaPlayer::MediaStatus stat); //automatically called
- void playerStateChanged(QMediaPlayer::State newstate); //automatically called by the media object
- void playerVideoAvailable(bool showVideo); //automatically called by the media object
- void playerDurationChanged(qint64);
- void playerTimeChanged(qint64 ctime); //automatically called by the media object
- void playerSliderMoved(int);
- void playerSliderHeld();
- void playerSliderChanged();
- void playerFileChanged();
+ //Backend Info passing
+ void DirDataAvailable(QString, QString, LFileInfoList);
+ void SnapshotDataAvailable(QString, QString, QStringList);
- //Context Menu Actions
- void OpenItem(); //run "lumina-open" on it
- void OpenItemWith(); //run "lumina-open -select" on it
- //void OpenDir(); //open the dir in a new tab
- void RemoveItem(); //Remove the item permanently
- // - single item actions
- void RenameItem();
- void FavoriteItem();
- // - full selection actions
- void ViewPropertiesItem();
- void openTerminal();
- void CutItems();
- void CopyItems();
- void PasteItems();
- void ChecksumItems();
+ //Dir Browser Interactions
+ void OpenPlayer(LFileInfoList);
+ void OpenImages(LFileInfoList);
+ void OpenTerminal(QString dirpath);
+ 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
+ void CloseBrowser(QString); //ID
//file info in status bar
void DisplayStatusBar(QString);
signals:
- void DirChanged(QString path);
void Si_AdaptStatusBar(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles);
protected:
diff --git a/lumina-fm/MainUI.ui b/lumina-fm/MainUI.ui
index a978e871..184df872 100644
--- a/lumina-fm/MainUI.ui
+++ b/lumina-fm/MainUI.ui
@@ -14,18 +14,18 @@
<string>Insight</string>
</property>
<widget class="QWidget" name="centralwidget">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
- <number>1</number>
+ <number>0</number>
</property>
<property name="topMargin">
- <number>1</number>
+ <number>0</number>
</property>
<property name="rightMargin">
- <number>1</number>
+ <number>0</number>
</property>
<property name="bottomMargin">
- <number>1</number>
+ <number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="stackedWidget">
@@ -33,1068 +33,26 @@
<number>0</number>
</property>
<widget class="QWidget" name="page_browser">
- <layout class="QGridLayout" name="gridLayout">
+ <layout class="QHBoxLayout" name="BrowserLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
<property name="leftMargin">
- <number>1</number>
+ <number>0</number>
</property>
<property name="topMargin">
- <number>2</number>
+ <number>0</number>
</property>
<property name="rightMargin">
- <number>2</number>
+ <number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
- <property name="spacing">
- <number>1</number>
- </property>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_browser">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QListView" name="list_dir_view">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="showDropIndicator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="dragEnabled">
- <bool>true</bool>
- </property>
- <property name="dragDropMode">
- <enum>QAbstractItemView::InternalMove</enum>
- </property>
- <property name="defaultDropAction">
- <enum>Qt::MoveAction</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="textElideMode">
- <enum>Qt::ElideRight</enum>
- </property>
- <property name="isWrapping" stdset="0">
- <bool>true</bool>
- </property>
- <property name="resizeMode">
- <enum>QListView::Adjust</enum>
- </property>
- <property name="layoutMode">
- <enum>QListView::SinglePass</enum>
- </property>
- <property name="spacing">
- <number>1</number>
- </property>
- <property name="uniformItemSizes">
- <bool>false</bool>
- </property>
- <property name="batchSize">
- <number>10</number>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- <property name="selectionRectVisible">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTreeView" name="tree_dir_view">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <property name="showDropIndicator" stdset="0">
- <bool>true</bool>
- </property>
- <property name="dragEnabled">
- <bool>true</bool>
- </property>
- <property name="dragDropMode">
- <enum>QAbstractItemView::InternalMove</enum>
- </property>
- <property name="defaultDropAction">
- <enum>Qt::MoveAction</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="indentation">
- <number>0</number>
- </property>
- <property name="rootIsDecorated">
- <bool>false</bool>
- </property>
- <property name="uniformRowHeights">
- <bool>true</bool>
- </property>
- <property name="itemsExpandable">
- <bool>false</bool>
- </property>
- <property name="sortingEnabled">
- <bool>true</bool>
- </property>
- <property name="expandsOnDoubleClick">
- <bool>false</bool>
- </property>
- <attribute name="headerCascadingSectionResizes">
- <bool>true</bool>
- </attribute>
- <attribute name="headerMinimumSectionSize">
- <number>30</number>
- </attribute>
- <attribute name="headerStretchLastSection">
- <bool>true</bool>
- </attribute>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="0">
- <widget class="QGroupBox" name="group_actions">
- <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>
- <item row="1" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label_dir_stats">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_addNewFile">
- <property name="statusTip">
- <string>Create a new file</string>
- </property>
- <property name="text">
- <string>New &amp;file</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_addToDir">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="statusTip">
- <string>Create a new subdirectory</string>
- </property>
- <property name="text">
- <string notr="true">&amp;New Dir</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+N</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_goToPlayer">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Open Multimedia Player</string>
- </property>
- <property name="statusTip">
- <string>Play any multimedia files in this directory</string>
- </property>
- <property name="text">
- <string>&amp;Play</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+P, Ctrl+S</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_goToImages">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>View Slideshow</string>
- </property>
- <property name="statusTip">
- <string>View all the images in this directory as a slideshow</string>
- </property>
- <property name="text">
- <string>&amp;Slideshow</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+S</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_goToRestore">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Restore File(s)</string>
- </property>
- <property name="statusTip">
- <string>Restore old versions of files or directories</string>
- </property>
- <property name="text">
- <string>&amp;Backups</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+B</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_audioPlayer">
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="check_player_gotonext">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Go To Next</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_3">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_player_prev">
- <property name="text">
- <string notr="true">prev</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="combo_player_list">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_player_next">
- <property name="text">
- <string notr="true">next</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="videoLayout">
- <item>
- <widget class="QLabel" name="label_player_novideo">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <pointsize>13</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="styleSheet">
- <string notr="true">background: black; color: white;</string>
- </property>
- <property name="text">
- <string>(No Running Video)</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="videoControlLayout">
- <item>
- <widget class="QToolButton" name="tool_player_play">
- <property name="text">
- <string notr="true">play</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_player_pause">
- <property name="text">
- <string notr="true">pause</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_player_stop">
- <property name="text">
- <string notr="true">stop</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_4">
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_player_runstats">
- <property name="text">
- <string notr="true">?/?</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_image_view">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QToolButton" name="tool_image_remove">
- <property name="toolTip">
- <string>Delete this image file</string>
- </property>
- <property name="text">
- <string notr="true">...</string>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_8">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_image_rotateleft">
- <property name="toolTip">
- <string>Rotate this image file counter-clockwise</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_image_rotateright">
- <property name="toolTip">
- <string>Rotate this image file clockwise</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>
- </item>
- <item>
- <widget class="QLabel" name="label_image">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="styleSheet">
- <string notr="true">QLabel{ background: grey; }</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="scaledContents">
- <bool>false</bool>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <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>
- <item>
- <widget class="QToolButton" name="tool_image_goBegin">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Go to Beginning</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="shortcut">
- <string>Shift+Left</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_image_goPrev">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Go to Previous</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="shortcut">
- <string>Left</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line">
- <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>
- <widget class="QComboBox" name="combo_image_name">
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="frame">
- <bool>true</bool>
- </property>
- <item>
- <property name="text">
- <string>File Name</string>
- </property>
- </item>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_image_index">
- <property name="text">
- <string notr="true">1/10</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <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>
- <widget class="QToolButton" name="tool_image_goNext">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Go to Next</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="shortcut">
- <string>Right</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_image_goEnd">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="toolTip">
- <string>Go to End</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="shortcut">
- <string>Shift+Right</string>
- </property>
- </widget>
- </item>
- <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>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page_zfs">
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <widget class="QToolButton" name="tool_zfs_prevSnap">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="text">
- <string>Older</string>
- </property>
- <property name="shortcut">
- <string>Left</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextUnderIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QSlider" name="slider_zfs_snapshot">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="maximum">
- <number>20</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_zfs_snap">
- <property name="text">
- <string notr="true">Snapshot</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QToolButton" name="tool_zfs_nextSnap">
- <property name="focusPolicy">
- <enum>Qt::NoFocus</enum>
- </property>
- <property name="text">
- <string>Newer</string>
- </property>
- <property name="shortcut">
- <string>Right</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextUnderIcon</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTreeView" name="tree_zfs_dir">
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
- <property name="rootIsDecorated">
- <bool>false</bool>
- </property>
- <property name="itemsExpandable">
- <bool>false</bool>
- </property>
- <property name="sortingEnabled">
- <bool>true</bool>
- </property>
- <property name="expandsOnDoubleClick">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_8">
- <item>
- <widget class="QToolButton" name="tool_zfs_restoreItem">
- <property name="toolTip">
- <string>Restore Selected Item</string>
- </property>
- <property name="text">
- <string>&amp;Restore Selection</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+R</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <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="QCheckBox" name="check_zfs_overwrite">
- <property name="text">
- <string>&amp;Overwrite Existing Files</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+O</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
+ <widget class="QWidget" name="page_player"/>
+ <widget class="QWidget" name="page_image"/>
</widget>
</item>
</layout>
@@ -1121,10 +79,27 @@
<property name="title">
<string>View</string>
</property>
+ <widget class="QMenu" name="menuView_Mode">
+ <property name="title">
+ <string>View Mode</string>
+ </property>
+ <addaction name="actionTabs"/>
+ </widget>
+ <widget class="QMenu" name="menuGroup_Mode">
+ <property name="title">
+ <string>Group Mode</string>
+ </property>
+ <addaction name="actionTabs_2"/>
+ </widget>
<addaction name="actionShow_Thumbnails"/>
<addaction name="actionView_Hidden_Files"/>
<addaction name="actionShow_Action_Buttons"/>
<addaction name="separator"/>
+ <addaction name="menuView_Mode"/>
+ <addaction name="menuGroup_Mode"/>
+ <addaction name="separator"/>
+ <addaction name="actionLarger_Icons"/>
+ <addaction name="actionSmaller_Icons"/>
</widget>
<widget class="QMenu" name="menuBookmarks">
<property name="title">
@@ -1145,31 +120,6 @@
<addaction name="menuExternal_Devices"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
- <widget class="QToolBar" name="toolBar">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="windowTitle">
- <string>toolBar</string>
- </property>
- <property name="movable">
- <bool>false</bool>
- </property>
- <property name="floatable">
- <bool>false</bool>
- </property>
- <attribute name="toolBarArea">
- <enum>TopToolBarArea</enum>
- </attribute>
- <attribute name="toolBarBreak">
- <bool>false</bool>
- </attribute>
- <addaction name="actionBackToBrowser"/>
- <addaction name="actionBack"/>
- <addaction name="actionUpDir"/>
- <addaction name="actionHome"/>
- <addaction name="actionBookMark"/>
- </widget>
<action name="actionNew_Tab">
<property name="text">
<string>New &amp;Tab</string>
@@ -1194,28 +144,6 @@
<string>&amp;Preferences</string>
</property>
</action>
- <action name="actionUpDir">
- <property name="text">
- <string>UpDir</string>
- </property>
- <property name="toolTip">
- <string>Go up one directory</string>
- </property>
- <property name="shortcut">
- <string>Alt+Up</string>
- </property>
- </action>
- <action name="actionHome">
- <property name="text">
- <string>&amp;Home</string>
- </property>
- <property name="toolTip">
- <string>Go to your home directory</string>
- </property>
- <property name="shortcut">
- <string>Alt+H</string>
- </property>
- </action>
<action name="actionView_Hidden_Files">
<property name="checkable">
<bool>true</bool>
@@ -1227,47 +155,11 @@
<string>Show Hidden Files</string>
</property>
</action>
- <action name="actionBack">
- <property name="text">
- <string>Back</string>
- </property>
- <property name="toolTip">
- <string>Back to directory</string>
- </property>
- <property name="shortcut">
- <string>Alt+Left</string>
- </property>
- </action>
- <action name="actionBookMark">
- <property name="text">
- <string>Bookmark</string>
- </property>
- <property name="toolTip">
- <string>Bookmark this directory</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+D</string>
- </property>
- </action>
<action name="actionScan">
<property name="text">
<string>Scan for Devices</string>
</property>
</action>
- <action name="actionBackToBrowser">
- <property name="text">
- <string notr="true">BBack</string>
- </property>
- <property name="iconText">
- <string notr="true">BBack</string>
- </property>
- <property name="toolTip">
- <string>Back to the system</string>
- </property>
- <property name="shortcut">
- <string>Alt+Left</string>
- </property>
- </action>
<action name="actionManage_Bookmarks">
<property name="enabled">
<bool>true</bool>
@@ -1309,6 +201,48 @@
<string>Ctrl+F</string>
</property>
</action>
+ <action name="actionTabs">
+ <property name="text">
+ <string notr="true">details</string>
+ </property>
+ <property name="iconText">
+ <string notr="true">details</string>
+ </property>
+ <property name="toolTip">
+ <string notr="true">details</string>
+ </property>
+ </action>
+ <action name="actionTabs_2">
+ <property name="text">
+ <string notr="true">tabs</string>
+ </property>
+ <property name="iconText">
+ <string notr="true">tabs</string>
+ </property>
+ <property name="toolTip">
+ <string notr="true">tabs</string>
+ </property>
+ </action>
+ <action name="actionIncrease_Icon_Size">
+ <property name="text">
+ <string>Increase Icon Size</string>
+ </property>
+ </action>
+ <action name="actionDecrease_Icon_Size">
+ <property name="text">
+ <string>Decrease Icon Size</string>
+ </property>
+ </action>
+ <action name="actionLarger_Icons">
+ <property name="text">
+ <string>Larger Icons</string>
+ </property>
+ </action>
+ <action name="actionSmaller_Icons">
+ <property name="text">
+ <string>Smaller Icons</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
diff --git a/lumina-fm/MimeIconProvider.h b/lumina-fm/MimeIconProvider.h
deleted file mode 100644
index 0c9ba98e..00000000
--- a/lumina-fm/MimeIconProvider.h
+++ /dev/null
@@ -1,67 +0,0 @@
-//===========================================
-// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
-// Available under the 3-clause BSD license
-// See the LICENSE file for full details
-//===========================================
-// This is the Icon provider for files based on mime types
-//===========================================
-#ifndef _LUMINA_FILE_MANAGER_ICON_PROVIDER_H
-#define _LUMINA_FILE_MANAGER_ICON_PROVIDER_H
-
-#include <QFileIconProvider>
-#include <QIcon>
-#include <QString>
-#include <QFileInfo>
-
-#include <LuminaXDG.h>
-
-class MimeIconProvider : public QFileIconProvider{
-
-public:
- bool showthumbnails;
- MimeIconProvider() : QFileIconProvider(){
- showthumbnails = false;
- }
- ~MimeIconProvider(){}
-
-
-
- QIcon icon(const QFileInfo &info) const{
- if(info.isDir()){
- return LXDG::findIcon("folder","");
- }else if(info.isFile()){
- if(showthumbnails && (info.suffix().toLower()=="png" || info.suffix().toLower()=="jpg") ){
- //make sure to only load small versions of the files into memory: could have hundreds of them...
- return QIcon( QPixmap(info.absoluteFilePath()).scaledToHeight(64) );
- }else if(info.fileName().endsWith(".desktop") ){
- bool ok = false;
- XDGDesktop desk = LXDG::loadDesktopFile(info.absoluteFilePath(), ok);
- if(ok){
- return LXDG::findIcon(desk.icon, "unknown");
- }else{
- return LXDG::findMimeIcon(info.fileName());
- }
- }else{
- return LXDG::findMimeIcon(info.fileName());
- }
- }else{
- return LXDG::findIcon("unknown","");
- }
- }
-
- QString type(const QFileInfo &info) const{
- if(info.isDir()){
- return QObject::tr("Directory");
- }else if(info.completeBaseName().isEmpty() || info.suffix().isEmpty() ){
- return QObject::tr("Unknown"); //hidden file without an extension
- }else if(info.suffix()=="desktop"){
- return QObject::tr("Application");
- }else{
- return info.suffix().toUpper();
- }
- }
-
-};
-
-#endif
diff --git a/lumina-fm/lumina-fm.pro b/lumina-fm/lumina-fm.pro
index 2a7d0b80..8dddd1d1 100644
--- a/lumina-fm/lumina-fm.pro
+++ b/lumina-fm/lumina-fm.pro
@@ -18,7 +18,6 @@ SOURCES += main.cpp \
MainUI.cpp \
FODialog.cpp \
BMMDialog.cpp \
- BackgroundWorker.cpp \
widgets/MultimediaWidget.cpp \
widgets/SlideshowWidget.cpp \
widgets/DirWidget.cpp
@@ -26,9 +25,6 @@ SOURCES += main.cpp \
HEADERS += MainUI.h \
FODialog.h \
BMMDialog.h \
- MimeIconProvider.h \
- BackgroundWorker.h \
- DDFileSystemModel.h \
DirData.h \
widgets/MultimediaWidget.h \
widgets/SlideshowWidget.h \
diff --git a/lumina-fm/main.cpp b/lumina-fm/main.cpp
index 24fd231c..b05c4016 100644
--- a/lumina-fm/main.cpp
+++ b/lumina-fm/main.cpp
@@ -3,7 +3,7 @@
#include <QFile>
#include <QStringList>
-#include "MainUI-old.h"
+#include "MainUI.h"
#include <LuminaOS.h>
#include <LuminaThemes.h>
#include <LuminaUtils.h>
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp
index b32e5c20..775a252b 100644
--- a/lumina-fm/widgets/DirWidget.cpp
+++ b/lumina-fm/widgets/DirWidget.cpp
@@ -19,9 +19,36 @@
DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new Ui::DirWidget){
ui->setupUi(this); //load the designer file
ID = objID;
+ //Assemble the toolbar for the widget
+ toolbar = new QToolBar(this);
+ toolbar->setContextMenuPolicy(Qt::CustomContextMenu);
+ toolbar->setFloatable(false);
+ toolbar->setMovable(false);
+ toolbar->setOrientation(Qt::Horizontal);
+ toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ //toolbar->setIconSize(QSize(32,32));
+ ui->toolbar_layout->addWidget(toolbar);
+ // - Add the buttons to the toolbar
+ toolbar->addAction(ui->actionBack);
+ toolbar->addAction(ui->actionUp);
+ toolbar->addAction(ui->actionHome);
+ line_dir = new QLineEdit(this);
+ toolbar->addWidget(line_dir);
+ toolbar->addAction(ui->actionStopLoad);
+ toolbar->addAction(ui->actionClose_Browser);
+ //Create the keyboard shortcuts
+ copyFilesShort = new QShortcut( QKeySequence(tr("Ctrl+C")), this);
+ pasteFilesShort = new QShortcut( QKeySequence(tr("Ctrl+V")), this);
+ cutFilesShort = new QShortcut( QKeySequence(tr("Ctrl+X")), this);
+ deleteFilesShort = new QShortcut( QKeySequence(tr("Delete")), this);
+ refreshShort = new QShortcut( QKeySequence(tr("F5")), this);
+ //Create the filesystem watcher
+ watcher = new QFileSystemWatcher(this);
+ //Now update the rest of the UI
canmodify = false; //initial value
contextMenu = new QMenu(this);
setShowDetails(true);
+ setShowThumbnails(true);
UpdateIcons();
UpdateText();
setupConnections();
@@ -31,24 +58,71 @@ DirWidget::~DirWidget(){
}
+void DirWidget::ChangeDir(QString dirpath){
+ emit LoadDirectory(ID, dirpath);
+}
+
+void DirWidget::setDirCompleter(QCompleter *comp){
+ line_dir->setCompleter(comp);
+}
+
QString DirWidget::id(){
return ID;
}
+QString DirWidget::currentDir(){
+ return CDIR;
+}
+
void DirWidget::setShowDetails(bool show){
showDetails = show;
ui->listWidget->setVisible(!showDetails);
ui->treeWidget->setVisible(showDetails);
+ this->refresh();
}
void DirWidget::setShowSidebar(bool show){
ui->group_actions->setVisible(show);
}
+void DirWidget::setShowThumbnails(bool show){
+ showThumbs = show;
+ this->refresh();
+}
+
void DirWidget::setDetails(QList<DETAILTYPES> list){
listDetails = list;
+ //Need to re-create the header item as well
+ QTreeWidgetItem *it = new QTreeWidgetItem();
+ int nmcol = -1; int typecol = -1;
+ for(int t=0; t<listDetails.length(); t++){
+ switch(listDetails[t]){
+ case NAME:
+ it->setText(t,tr("Name"));
+ nmcol = t;
+ break;
+ case SIZE:
+ it->setText(t,tr("Size"));
+ break;
+ case TYPE:
+ it->setText(t, tr("Type"));
+ typecol = t;
+ break;
+ case DATEMOD:
+ it->setText(t, tr("Date Modified") );
+ break;
+ case DATECREATE:
+ it->setText(t, tr("Date Created") );
+ break;
+ }
+ }
+ ui->treeWidget->setHeaderItem(it);
+ //Now reset the sorting (alphabetically, dirs first)
+ if(nmcol>=0){ ui->treeWidget->sortItems(nmcol, Qt::AscendingOrder); } // sort by name
+ if(typecol>=0){ ui->treeWidget->sortItems(typecol, Qt::AscendingOrder); } //sort by type first
+
if(CDIR.isEmpty() || !showDetails){ return; } //don't need to reload dir if details are not visible
- emit LoadDirectory(ID, CDIR);
+ this->refresh();
}
void DirWidget::setThumbnailSize(int px){
@@ -56,17 +130,25 @@ void DirWidget::setThumbnailSize(int px){
ui->listWidget->setIconSize(QSize(px,px));
ui->treeWidget->setIconSize(QSize(px,px));
if(CDIR.isEmpty() || !larger ){ return; } //don't need to reload icons unless the new size is larger
- emit LoadDirectory(ID, CDIR);
+ this->refresh();
+}
+
+void DirWidget::setShowCloseButton(bool show){
+ ui->actionClose_Browser->setVisible(show);
}
+
// ================
// PUBLIC SLOTS
// ================
void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
if(dir.isEmpty()){ return; } //nothing to do
+ qDebug() << "Load Dir:" << dir;
QString lastdir = CDIR; //for some checks later
- canmodify = QFileInfo(CDIR).isWritable();
- CLIST = list; //save for later
+ QString lastbasedir = normalbasedir;
CDIR = dir;
+ if(CDIR.endsWith("/")){ CDIR.chop(1); }
+ CLIST = list; //save for laterr
+ canmodify = QFileInfo(CDIR).isWritable();
//Hide the extra buttons for a moment
ui->tool_goToPlayer->setVisible(false);
ui->tool_goToImages->setVisible(false);
@@ -75,7 +157,10 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
if( dir.contains(ZSNAPDIR) ){
//This is a zfs snapshot - only update the saved paths necessary to rotate between snapshots/system
snaprelpath = dir.section(ZSNAPDIR,1,1000).section("/",1,1000); //the relative path inside the snapshot
+ if(snaprelpath.endsWith("/")){ snaprelpath.chop(1); }
normalbasedir = dir.section(ZSNAPDIR,0,0)+"/"+snaprelpath; //Update the new base directory
+ if(normalbasedir.endsWith("/")){ normalbasedir.chop(1); }
+ line_dir->setText(normalbasedir);
//See if this was a manual move to the directory, or an internal move
QString tmp = dir.section(ZSNAPDIR,0,0);
if(tmp != snapbasedir.section(ZSNAPDIR,0,0)){
@@ -83,7 +168,8 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
}
}else{
//This is a normal directory - prompt for snapshot information
- normalbasedir = dir;
+ line_dir->setText(CDIR);
+ normalbasedir = CDIR;
snapbasedir.clear();
loadsnaps = true;
}
@@ -94,37 +180,32 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
ui->slider_snap->setRange(1,1);
emit findSnaps(ID, normalbasedir);
}
+ //Now update the history for this browser
+ if(!history.isEmpty() && history.last() == normalbasedir && lastbasedir!=normalbasedir ){
+ //We went back one - remove this from the history
+ history.takeLast();
+ ui->actionBack->setEnabled(!history.isEmpty());
+ }else if(lastbasedir!=normalbasedir){ //not a refresh or internal snapshot change
+ history << normalbasedir;
+ ui->actionBack->setEnabled(history.length()>1);
+ }
+ //Clear the current watcher
+ if(!watcher->directories().isEmpty()){ watcher->removePaths(watcher->directories()); }
+ if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); }
+ watcher->addPath(CDIR);
+ ui->actionStopLoad->setVisible(true);
+ stopload = false;
//Clear the display widget
- if(showDetails){
- ui->treeWidget->clear();
- //Need to re-create the header item as well
- QTreeWidgetItem *it = new QTreeWidgetItem();
- for(int t=0; t<listDetails.length(); t++){
- 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(); }
+ if(showDetails){ ui->treeWidget->clear(); }
+ else{ ui->listWidget->clear(); }
//Now fill the display widget
bool hasimages, hasmultimedia;
hasimages = hasmultimedia = false;
for(int i=0; i<list.length(); i++){
+ if(stopload){ ui->actionStopLoad->setVisible(false); return; } //stop right now
hasimages = hasimages || list[i].isImage();
hasmultimedia = hasmultimedia || list[i].isAVFile();
+ //watcher->addPath(list[i].absoluteFilePath());
if(showDetails){
//Now create all the individual items for the details tree
QTreeWidgetItem *it = new QTreeWidgetItem();
@@ -133,8 +214,10 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
switch(listDetails[t]){
case NAME:
it->setText(t,list[i].fileName());
+ it->setStatusTip(t, list[i].fileName());
if(list[i].isImage()){
- it->setIcon(t, QIcon( QPixmap(list[i].absoluteFilePath()).scaledToHeight(ui->treeWidget->iconSize().height()) ) );
+ if(showThumbs){ it->setIcon(t, QIcon( QPixmap(list[i].absoluteFilePath()).scaledToHeight(ui->treeWidget->iconSize().height()) ) ); }
+ else{ it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); }
}else{
it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"unknown") );
}
@@ -146,6 +229,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
break;
case TYPE:
it->setText(t, list[i].mimetype());
+ break;
case DATEMOD:
it->setText(t, list[i].lastModified().toString(Qt::DefaultLocaleShortDate) );
break;
@@ -164,8 +248,10 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
QListWidgetItem *it = new QListWidgetItem();
it->setWhatsThis(list[i].fileName());
it->setText(list[i].fileName());
+ it->setStatusTip(list[i].fileName());
if(list[i].isImage()){
- it->setIcon(QIcon( QPixmap(list[i].absoluteFilePath()).scaledToHeight(ui->listWidget->iconSize().height()) ) );
+ if(showThumbs){ it->setIcon(QIcon( QPixmap(list[i].absoluteFilePath()).scaledToHeight(ui->treeWidget->iconSize().height()) ) ); }
+ else{ it->setIcon(LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); }
}else{
it->setIcon(LXDG::findIcon(list[i].iconfile(),"unknown") );
}
@@ -177,15 +263,19 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
}
QApplication::processEvents(); //keep the UI snappy while loading a directory
}
+ ui->actionStopLoad->setVisible(false);
//Another check to ensure the current item is visible
if(showDetails){
if(ui->treeWidget->currentItem()!=0){ ui->treeWidget->scrollToItem(ui->treeWidget->currentItem()); }
+ for(int t=0; t<ui->treeWidget->columnCount(); t++){ui->treeWidget->resizeColumnToContents(t); }
}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);
+ ui->tool_goToPlayer->setVisible(hasmultimedia);
+ ui->tool_goToImages->setVisible(hasimages);
+ if(canmodify){ ui->label_status->setText(""); }
+ else{ ui->label_status->setText(tr("Restricted Access")); }
}
void DirWidget::LoadSnaps(QString basedir, QStringList snaps){
@@ -211,6 +301,17 @@ void DirWidget::LoadSnaps(QString basedir, QStringList snaps){
}
+void DirWidget::refresh(){
+ if(!CDIR.isEmpty() && ~ID.isEmpty()){
+ stopload = true; //just in case it is still loading
+ emit LoadDirectory(ID, CDIR);
+ }
+}
+
+void DirWidget::refreshButtons(){
+ SelectionChanged();
+}
+
//Theme change functions
void DirWidget::UpdateIcons(){
//ui->tool_addNewFile->setIcon( LXDG::findIcon("document-new",""));
@@ -231,6 +332,12 @@ 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","") );
+ //ToolBar Buttons
+ ui->actionBack->setIcon( LXDG::findIcon("go-previous","") );
+ ui->actionUp->setIcon( LXDG::findIcon("go-up","") );
+ ui->actionHome->setIcon( LXDG::findIcon("go-home","") );
+ ui->actionStopLoad->setIcon( LXDG::findIcon("dialog-cancel","") );
+ ui->actionClose_Browser->setIcon( LXDG::findIcon("dialog-close","") );
}
void DirWidget::UpdateText(){
@@ -252,13 +359,19 @@ void DirWidget::setupConnections(){
connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) );
//Activation routines
- connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*)), this, SLOT(on_tool_act_run_clicked()) );
+ connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(on_tool_act_run_clicked()) );
connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(on_tool_act_run_clicked()) );
- connect(ui->treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*)), this, SLOT(on_tool_act_run_clicked()) );
- connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(on_tool_act_run_clicked()) );
+ connect(line_dir, SIGNAL(returnPressed()), this, SLOT(dir_changed()) );
-
-
+ //Keyboard Shortcuts
+ connect(copyFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_copy_clicked() ) );
+ connect(cutFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_cut_clicked() ) );
+ connect(pasteFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_paste_clicked() ) );
+ connect(deleteFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_rm_clicked() ) );
+ connect(refreshShort, SIGNAL(activated()), this, SLOT( refresh()) );
+ //Filesystem Watcher
+ connect(watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(refresh()) );
+ connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(refresh()) ); //just in case
}
QStringList DirWidget::currentSelection(){
@@ -352,11 +465,33 @@ void DirWidget::on_tool_act_runwith_clicked(){
// -- Bottom Action Buttons
void DirWidget::on_tool_goToImages_clicked(){
- emit ViewFiles(CLIST);
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ emit ViewFiles(CLIST); }
+ else{
+ //Just use the files from the current selection
+ LFileInfoList list;
+ for(int i=0; i<CLIST.length(); i++){
+ if(CLIST[i].isImage() && sel.contains(CLIST[i].fileName()) ){
+ list << CLIST[i]; //add to the list
+ }
+ }
+ if(!list.isEmpty()){ emit ViewFiles(list); }
+ }
}
void DirWidget::on_tool_goToPlayer_clicked(){
- emit PlayFiles(CLIST);
+ QStringList sel = currentSelection();
+ if(sel.isEmpty()){ emit PlayFiles(CLIST); }
+ else{
+ //Just use the files from the current selection
+ LFileInfoList list;
+ for(int i=0; i<CLIST.length(); i++){
+ if(CLIST[i].isAVFile() && sel.contains(CLIST[i].fileName()) ){
+ list << CLIST[i]; //add to the list
+ }
+ }
+ if(!list.isEmpty()){ emit PlayFiles(list); }
+ }
}
// -- Top Snapshot Buttons
@@ -381,29 +516,73 @@ void DirWidget::on_slider_snap_valueChanged(int val){
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;
+ //qDebug() << "Changing snapshot:" << CDIR << val;
+ stopload = true; //stop any currently-loading procedures
if(val >= snapshots.length() || val < 0){ //active system selected
- qDebug() << " - Load Active system:" << normalbasedir;
+ //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;
+ //qDebug() << " - new snapshot-relative path:" << snaprelpath;
}
dir.append(snaprelpath);
- qDebug() << " - Load Snapshot:" << dir;
+ dir.replace("//","/"); //just in case any duplicate slashes from all the split/combining
+ //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
+ dir = dir.section("/",0,-2); //back up one dir
}
if(dir.isEmpty()){ return; }
//Load the newly selected snapshot
emit LoadDirectory(ID, dir);
}
+//Top Toolbar buttons
+void DirWidget::on_actionBack_triggered(){
+ if(history.isEmpty()){ return; } //cannot do anything
+ QString dir = history.takeLast();
+ if(dir == normalbasedir){
+ dir = history.last();
+ }
+ emit LoadDirectory(ID, dir);
+}
+
+void DirWidget::on_actionUp_triggered(){
+ QString dir = CDIR.section("/",0,-2);
+ //Quick check to ensure the directory exists
+ while(!QFile::exists(dir) && !dir.isEmpty()){
+ dir = dir.section("/",0,-2); //back up one additional dir
+ }
+ emit LoadDirectory(ID, dir);
+}
+
+void DirWidget::on_actionHome_triggered(){
+ emit LoadDirectory(ID, QDir::homePath());
+}
+
+void DirWidget::on_actionStopLoad_triggered(){
+ stopload = true;
+ ui->actionStopLoad->setVisible(false);
+}
+
+void DirWidget::dir_changed(){
+ QString dir = line_dir->text();
+ //Quick check to ensure the directory exists
+ while(!QFile::exists(dir) && !dir.isEmpty()){
+ dir = dir.section("/",0,-2); //back up one additional dir
+ }
+ emit LoadDirectory(ID, dir);
+}
+
+void DirWidget::on_actionClose_Browser_triggered(){
+ emit CloseBrowser(ID);
+}
+
// - Other Actions without a specific button on the side
void DirWidget::fileCheckSums(){
QStringList files = currentSelection();
diff --git a/lumina-fm/widgets/DirWidget.h b/lumina-fm/widgets/DirWidget.h
index 646df309..193d1789 100644
--- a/lumina-fm/widgets/DirWidget.h
+++ b/lumina-fm/widgets/DirWidget.h
@@ -11,6 +11,11 @@
#include <QWidget>
#include <QObject>
#include <QMenu>
+#include <QToolBar>
+#include <QLineEdit>
+#include <QShortcut>
+#include <QFileSystemWatcher>
+
#include "../DirData.h"
@@ -26,16 +31,30 @@ public:
enum DETAILTYPES{ NAME, SIZE, TYPE, DATEMOD, DATECREATE};
DirWidget(QString objID, QWidget *parent = 0); //needs a unique ID (to distinguish from other DirWidgets)
~DirWidget();
-
+
+ //Directory Managment
+ void ChangeDir(QString dirpath);
+ void setDirCompleter(QCompleter *comp);
+
+ //Information
QString id();
+ QString currentDir();
+
+ //View Settings
void setShowDetails(bool show);
void setShowSidebar(bool show);
+ void setShowThumbnails(bool show);
void setDetails(QList<DETAILTYPES> list); //Which details to show and in which order (L->R)
void setThumbnailSize(int px);
+ void setShowCloseButton(bool show);
public slots:
- void LoadDir(QString dir, QList<LFileInfo> list);
+ void LoadDir(QString dir, LFileInfoList list);
void LoadSnaps(QString basedir, QStringList snaps);
+
+ //Refresh options
+ void refresh(); //Refresh current directory
+ void refreshButtons(); //Refresh action buttons only
//Theme change functions
void UpdateIcons();
@@ -47,13 +66,22 @@ public slots:
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)
+ LFileInfoList CLIST; //current item list (snap or not)
QString normalbasedir, snapbasedir, snaprelpath; //for maintaining direcoty context while moving between snapshots
QStringList snapshots;
- bool showDetails, canmodify; //which widget to use for showing items
+ bool showDetails, showThumbs, canmodify, stopload; //which widget to use for showing items
QList<DETAILTYPES> listDetails;
QMenu *contextMenu;
+ //The Toolbar and associated items
+ QToolBar *toolbar;
+ QLineEdit *line_dir;
+ QStringList history;
+ //Keyboard Shortcuts
+ QShortcut *copyFilesShort, *cutFilesShort, *pasteFilesShort, *deleteFilesShort, *refreshShort;
+ //Watcher to determine when the dir changes
+ QFileSystemWatcher *watcher;
+ //Functions for internal use
void setupConnections();
QStringList currentSelection();
@@ -75,6 +103,14 @@ private slots:
void on_tool_snap_newer_clicked();
void on_tool_snap_older_clicked();
void on_slider_snap_valueChanged(int);
+ //Top Toolbar buttons
+ void on_actionBack_triggered();
+ void on_actionUp_triggered();
+ void on_actionHome_triggered();
+ void on_actionStopLoad_triggered();
+ void dir_changed(); //user manually changed the directory
+ void on_actionClose_Browser_triggered();
+
// - Other Actions without a specific button on the side
void fileCheckSums();
void fileProperties();
@@ -91,10 +127,11 @@ signals:
void OpenDirectories(QStringList); //Directories to open in other tabs/columns
void LoadDirectory(QString, QString); //ID, dirpath (Directory to load here)
void findSnaps(QString, QString); //ID, dirpath (Request snapshot information for a directory)
+ void CloseBrowser(QString); //ID (Request that this browser be closed)
//External App/Widget launching
- void PlayFiles(QList<LFileInfo>); //open in multimedia player
- void ViewFiles(QList<LFileInfo>); //open in slideshow
+ void PlayFiles(LFileInfoList); //open in multimedia player
+ void ViewFiles(LFileInfoList); //open in slideshow
void LaunchTerminal(QString); //dirpath
//System Interactions
diff --git a/lumina-fm/widgets/DirWidget.ui b/lumina-fm/widgets/DirWidget.ui
index 2be5515d..9355d21e 100644
--- a/lumina-fm/widgets/DirWidget.ui
+++ b/lumina-fm/widgets/DirWidget.ui
@@ -7,29 +7,155 @@
<x>0</x>
<y>0</y>
<width>400</width>
- <height>333</height>
+ <height>334</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
+ <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
- <number>1</number>
+ <number>0</number>
</property>
<property name="topMargin">
- <number>1</number>
+ <number>0</number>
</property>
<property name="rightMargin">
- <number>1</number>
+ <number>0</number>
</property>
<property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <property name="horizontalSpacing">
<number>1</number>
</property>
- <property name="spacing">
+ <property name="verticalSpacing">
<number>2</number>
</property>
- <item row="0" column="0">
+ <item row="0" column="0" rowspan="2" colspan="2">
+ <layout class="QHBoxLayout" name="toolbar_layout"/>
+ </item>
+ <item row="1" column="1" rowspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="group_snaps">
+ <property name="title">
+ <string notr="true"/>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <property name="leftMargin">
+ <number>1</number>
+ </property>
+ <property name="topMargin">
+ <number>1</number>
+ </property>
+ <property name="rightMargin">
+ <number>1</number>
+ </property>
+ <property name="bottomMargin">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_snap">
+ <property name="text">
+ <string notr="true">Snap</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="slider_snap">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="invertedAppearance">
+ <bool>false</bool>
+ </property>
+ <property name="invertedControls">
+ <bool>false</bool>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::TicksAbove</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_snap_older">
+ <property name="text">
+ <string notr="true">...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_snap_newer">
+ <property name="text">
+ <string notr="true">...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTreeWidget" name="treeWidget">
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ <property name="indentation">
+ <number>0</number>
+ </property>
+ <property name="sortingEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <attribute name="headerMinimumSectionSize">
+ <number>30</number>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listWidget">
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectItems</enum>
+ </property>
+ <property name="flow">
+ <enum>QListView::TopToBottom</enum>
+ </property>
+ <property name="isWrapping" stdset="0">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
<widget class="QGroupBox" name="group_actions">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -269,109 +395,7 @@
</layout>
</widget>
</item>
- <item row="0" column="1">
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>1</number>
- </property>
- <item>
- <widget class="QGroupBox" name="group_snaps">
- <property name="title">
- <string>Snapshots Available</string>
- </property>
- <property name="flat">
- <bool>true</bool>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <property name="leftMargin">
- <number>1</number>
- </property>
- <property name="topMargin">
- <number>1</number>
- </property>
- <property name="rightMargin">
- <number>1</number>
- </property>
- <property name="bottomMargin">
- <number>1</number>
- </property>
- <item>
- <widget class="QLabel" name="label_snap">
- <property name="text">
- <string notr="true">Snap</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="slider_snap">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="value">
- <number>1</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="invertedAppearance">
- <bool>false</bool>
- </property>
- <property name="invertedControls">
- <bool>false</bool>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_snap_older">
- <property name="text">
- <string notr="true">...</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_snap_newer">
- <property name="text">
- <string notr="true">...</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QTreeWidget" name="treeWidget">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <column>
- <property name="text">
- <string notr="true">1</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <widget class="QListWidget" name="listWidget">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectItems</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0" colspan="2">
+ <item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_status">
@@ -382,21 +406,109 @@
</item>
<item>
<widget class="QToolButton" name="tool_goToImages">
+ <property name="statusTip">
+ <string>Add selected images to slideshow</string>
+ </property>
<property name="text">
- <string notr="true">img</string>
+ <string>Slideshow</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tool_goToPlayer">
+ <property name="statusTip">
+ <string>Enqueue selection in multimedia player</string>
+ </property>
<property name="text">
- <string notr="true">play</string>
+ <string>Play</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
+ <action name="actionBack">
+ <property name="text">
+ <string notr="true">Back</string>
+ </property>
+ <property name="iconText">
+ <string>Back</string>
+ </property>
+ <property name="toolTip">
+ <string>Go back to previous directory</string>
+ </property>
+ <property name="statusTip">
+ <string>Go back to previous directory</string>
+ </property>
+ </action>
+ <action name="actionUp">
+ <property name="text">
+ <string notr="true">Up</string>
+ </property>
+ <property name="iconText">
+ <string>Up</string>
+ </property>
+ <property name="toolTip">
+ <string>Go to parent directory</string>
+ </property>
+ <property name="statusTip">
+ <string>Go to parent directory</string>
+ </property>
+ </action>
+ <action name="actionHome">
+ <property name="text">
+ <string notr="true">Home</string>
+ </property>
+ <property name="iconText">
+ <string>Home</string>
+ </property>
+ <property name="toolTip">
+ <string>Go to home directory</string>
+ </property>
+ <property name="statusTip">
+ <string>Go to home directory</string>
+ </property>
+ </action>
+ <action name="actionStopLoad">
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="statusTip">
+ <string>Stopl loading the directory</string>
+ </property>
+ </action>
+ <action name="actionClose_Browser">
+ <property name="text">
+ <string notr="true">Close Browser</string>
+ </property>
+ <property name="iconText">
+ <string notr="true">Close Browser</string>
+ </property>
+ <property name="toolTip">
+ <string>Close this browser</string>
+ </property>
+ <property name="statusTip">
+ <string>Close this browser</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
diff --git a/lumina-fm/widgets/MultimediaWidget.cpp b/lumina-fm/widgets/MultimediaWidget.cpp
index 9622a97b..406f9098 100644
--- a/lumina-fm/widgets/MultimediaWidget.cpp
+++ b/lumina-fm/widgets/MultimediaWidget.cpp
@@ -47,9 +47,12 @@ MultimediaWidget::~MultimediaWidget(){
// ================
// PUBLIC SLOTS
// ================
-void MultimediaWidget::LoadMultimedia(QList<LFileInfo> list){
+void MultimediaWidget::ClearPlaylist(){
mediaObj->stop();
ui->combo_player_list->clear();
+}
+
+void MultimediaWidget::LoadMultimedia(QList<LFileInfo> list){
for(int i=0; i<list.length(); i++){
if(list[i].isAVFile()){ ui->combo_player_list->addItem(list[i].fileName(), list[i].absoluteFilePath() ); }
}
diff --git a/lumina-fm/widgets/MultimediaWidget.h b/lumina-fm/widgets/MultimediaWidget.h
index 65769d77..4dc92e39 100644
--- a/lumina-fm/widgets/MultimediaWidget.h
+++ b/lumina-fm/widgets/MultimediaWidget.h
@@ -27,6 +27,7 @@ public:
~MultimediaWidget();
public slots:
+ void ClearPlaylist();
void LoadMultimedia(QList<LFileInfo> list);
//Theme change functions
diff --git a/lumina-fm/widgets/SlideshowWidget.cpp b/lumina-fm/widgets/SlideshowWidget.cpp
index ff7113b6..a9028d2b 100644
--- a/lumina-fm/widgets/SlideshowWidget.cpp
+++ b/lumina-fm/widgets/SlideshowWidget.cpp
@@ -12,7 +12,7 @@
SlideshowWidget::SlideshowWidget(QWidget *parent) : QWidget(parent), ui(new Ui::SlideshowWidget){
ui->setupUi(this); //load the designer file
-
+ zoom = 1;
UpdateIcons();
UpdateText();
}
@@ -24,11 +24,21 @@ SlideshowWidget::~SlideshowWidget(){
// ================
// PUBLIC SLOTS
// ================
+void SlideshowWidget::ClearImages(){
+ ui->combo_image_name->clear();
+}
+
void SlideshowWidget::LoadImages(QList<LFileInfo> list){
- ui->combo_image_name->clear();
+ int cmax = ui->combo_image_name->count(); //current number of items
for(int i=0; i<list.length(); i++){
if(list[i].isImage()){ ui->combo_image_name->addItem(list[i].fileName(), list[i].absoluteFilePath() ); }
}
+ //Now automatically show the first item from the batch of new ones
+ if(cmax < ui->combo_image_name->count()){ ui->combo_image_name->setCurrentIndex(cmax); }
+}
+
+void SlideshowWidget::refresh(){
+ UpdateImage();
}
//Theme change functions
@@ -40,6 +50,8 @@ void SlideshowWidget::UpdateIcons(){
ui->tool_image_remove->setIcon( LXDG::findIcon("edit-delete","") );
ui->tool_image_rotateleft->setIcon( LXDG::findIcon("object-rotate-left","") );
ui->tool_image_rotateright->setIcon( LXDG::findIcon("object-rotate-right","") );
+ ui->tool_image_zoomin->setIcon( LXDG::findIcon("zoom-in","") );
+ ui->tool_image_zoomout->setIcon( LXDG::findIcon("zoom-out","") );
}
void SlideshowWidget::UpdateText(){
@@ -51,15 +63,12 @@ void SlideshowWidget::UpdateText(){
// PRIVATE
// =================
void SlideshowWidget::UpdateImage(){
- if( !ui->label_image->isVisible() ){ return; } //don't update if not visible - can cause strange resizing issues
QString file = ui->combo_image_name->currentData().toString();
- /*if(!file.endsWith("/")){ file.append("/"); }
- file.append(ui->combo_image_name->currentText());*/
- //qDebug() << "Show Image:" << file;
+ qDebug() << "Show Image:" << file << "Zoom:" << zoom;
QPixmap pix(file);
- if(pix.size().width() > ui->label_image->contentsRect().width() || pix.size().height() > ui->label_image->contentsRect().height()){
- pix = pix.scaled(ui->label_image->contentsRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
- }
+ QSize sz = ui->scrollArea->contentsRect().size();
+ if( sz.width()>pix.size().width() || sz.height()>pix.size().height()){ sz = pix.size(); } //100% size already - apply zoom after this
+ pix = pix.scaled(sz*zoom, Qt::KeepAspectRatio, Qt::SmoothTransformation);
ui->label_image->setPixmap(pix);
//Now set/load the buttons
ui->tool_image_goBegin->setEnabled(ui->combo_image_name->currentIndex()>0);
@@ -77,6 +86,8 @@ void SlideshowWidget::UpdateImage(){
ui->tool_image_remove->setEnabled(isUserWritable);
ui->tool_image_rotateleft->setEnabled(isUserWritable && canwrite);
ui->tool_image_rotateright->setEnabled(isUserWritable && canwrite);
+ ui->tool_image_zoomin->setEnabled(zoom<2);
+ ui->tool_image_zoomout->setEnabled(zoom>0.25);
}
@@ -84,8 +95,9 @@ void SlideshowWidget::UpdateImage(){
// PRIVATE SLOTS
// =================
// Picture rotation options
-void SlideshowWidget::on_combo_image_name_indexChanged(int index){
+void SlideshowWidget::on_combo_image_name_currentIndexChanged(int index){
if(index>=0 && !ui->combo_image_name->currentData().toString().isEmpty()){
+ zoom = 1; //always reset the zoom level when changing images
UpdateImage();
}
}
@@ -144,3 +156,14 @@ void SlideshowWidget::on_tool_image_rotateright_clicked(){
//Now re-load the image in the UI
UpdateImage();
}
+
+void SlideshowWidget::on_tool_image_zoomin_clicked(){
+ zoom+=0.25; //change 25% every time
+ UpdateImage();
+}
+
+void SlideshowWidget::on_tool_image_zoomout_clicked(){
+ zoom-=0.25; //change 25% every time
+ UpdateImage();
+}
+
diff --git a/lumina-fm/widgets/SlideshowWidget.h b/lumina-fm/widgets/SlideshowWidget.h
index bd8a671d..3b9c70fd 100644
--- a/lumina-fm/widgets/SlideshowWidget.h
+++ b/lumina-fm/widgets/SlideshowWidget.h
@@ -24,8 +24,11 @@ public:
~SlideshowWidget();
public slots:
+ void ClearImages();
void LoadImages(QList<LFileInfo> list);
+ void refresh(); //Note: This should be called right after the widget becomes visible
+
//Theme change functions
void UpdateIcons();
void UpdateText();
@@ -33,10 +36,11 @@ public slots:
private:
Ui::SlideshowWidget *ui;
void UpdateImage();
+ double zoom;
private slots:
// Picture rotation options
- void on_combo_image_name_indexChanged(int index);
+ void on_combo_image_name_currentIndexChanged(int index);
void on_tool_image_goEnd_clicked();
void on_tool_image_goNext_clicked();
void on_tool_image_goPrev_clicked();
@@ -46,6 +50,8 @@ private slots:
void on_tool_image_remove_clicked();
void on_tool_image_rotateleft_clicked();
void on_tool_image_rotateright_clicked();
+ void on_tool_image_zoomin_clicked();
+ void on_tool_image_zoomout_clicked();
};
#endif \ No newline at end of file
diff --git a/lumina-fm/widgets/SlideshowWidget.ui b/lumina-fm/widgets/SlideshowWidget.ui
index 82e203fd..d262d5ec 100644
--- a/lumina-fm/widgets/SlideshowWidget.ui
+++ b/lumina-fm/widgets/SlideshowWidget.ui
@@ -65,6 +65,45 @@
</widget>
</item>
<item>
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_image_zoomin">
+ <property name="toolTip">
+ <string>Zoom in</string>
+ </property>
+ <property name="statusTip">
+ <string>Zoom in</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_image_zoomout">
+ <property name="toolTip">
+ <string>Zoom out</string>
+ </property>
+ <property name="statusTip">
+ <string>Zoom out</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>
@@ -80,31 +119,59 @@
</layout>
</item>
<item>
- <widget class="QLabel" name="label_image">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="styleSheet">
- <string notr="true">QLabel{ background: grey; }</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <property name="text">
- <string notr="true"/>
- </property>
- <property name="scaledContents">
- <bool>false</bool>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="widgetResizable">
+ <bool>true</bool>
</property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>350</width>
+ <height>250</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <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="QLabel" name="label_image">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
</layout>
bgstack15