aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-fm/MainUI.cpp8
-rw-r--r--lumina-fm/MainUI.h3
-rw-r--r--lumina-fm/widgets/DDListWidgets.h12
-rw-r--r--lumina-fm/widgets/DirWidget.cpp25
-rw-r--r--lumina-fm/widgets/DirWidget.h2
-rw-r--r--lumina-fm/widgets/DirWidget.ui147
6 files changed, 114 insertions, 83 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index dfd3e2c9..1305e12d 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -85,6 +85,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
nextTabLShort = new QShortcut( QKeySequence(tr("Shift+Left")), this);
nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this);
closeTabShort = new QShortcut( QKeySequence(tr("Ctrl+W")), this);
+ refreshShort = new QShortcut( QKeySequence(tr("F5")), this);
//Finish loading the interface
workThread->start();
@@ -215,6 +216,8 @@ void MainUI::setupConnections(){
connect(nextTabLShort, SIGNAL(activated()), this, SLOT( prevTab() ) );
connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) );
connect(closeTabShort, SIGNAL(activated()), this, SLOT( tabClosed() ) );
+ connect(refreshShort , SIGNAL(activated()), this, SLOT( refreshTabs() ) );
+
}
@@ -571,6 +574,11 @@ void MainUI::nextTab(){
else{ tabBar->setCurrentIndex( cur+1 ); }
}
+void MainUI::refreshTabs(){
+ DirWidget *cur = FindActiveBrowser();
+ if(cur!=0){ cur->refresh(); }
+}
+
void MainUI::DirDataAvailable(QString id, QString dir, LFileInfoList list){
for(int i=0; i<DWLIST.length(); i++){
if(id == DWLIST[i]->id()){
diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h
index 0a68334a..f4dda453 100644
--- a/lumina-fm/MainUI.h
+++ b/lumina-fm/MainUI.h
@@ -88,7 +88,7 @@ private:
SlideshowWidget *SW;
QSettings *settings;
- QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort;
+ QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort, *refreshShort;
QCompleter *dirCompleter;
//Simplification Functions
@@ -129,6 +129,7 @@ private slots:
void tabClosed(int tab = -1);
void nextTab(); //For keyboard shortcuts
void prevTab(); //For keyboard shortcuts
+ void refreshTabs(); //For keyboard shortcut
//Backend Info passing
void DirDataAvailable(QString, QString, LFileInfoList);
diff --git a/lumina-fm/widgets/DDListWidgets.h b/lumina-fm/widgets/DDListWidgets.h
index c2601335..2c51e8cc 100644
--- a/lumina-fm/widgets/DDListWidgets.h
+++ b/lumina-fm/widgets/DDListWidgets.h
@@ -81,7 +81,11 @@ protected:
void dragMoveEvent(QDragMoveEvent *ev){
if(ev->mimeData()->hasUrls() && !this->whatsThis().isEmpty() ){
- ev->acceptProposedAction(); //allow this to be dropped here
+ //Change the drop type depending on the data/dir
+ QString home = QDir::homePath();
+ if( this->whatsThis().startsWith(home) ){ ev->setDropAction(Qt::MoveAction); }
+ else{ ev->setDropAction(Qt::CopyAction); }
+ ev->accept(); //allow this to be dropped here
}else{
ev->ignore();
}
@@ -184,7 +188,11 @@ protected:
void dragMoveEvent(QDragMoveEvent *ev){
if(ev->mimeData()->hasUrls() && !this->whatsThis().isEmpty() ){
- ev->acceptProposedAction(); //allow this to be dropped here
+ //Change the drop type depending on the data/dir
+ QString home = QDir::homePath();
+ if( this->whatsThis().startsWith(home) ){ ev->setDropAction(Qt::MoveAction); }
+ else{ ev->setDropAction(Qt::CopyAction); }
+ ev->accept(); //allow this to be dropped here
}else{
ev->ignore();
}
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp
index 8f4ed9f1..2cef549f 100644
--- a/lumina-fm/widgets/DirWidget.cpp
+++ b/lumina-fm/widgets/DirWidget.cpp
@@ -23,7 +23,7 @@
#include "../ScrollDialog.h"
#ifndef DEBUG
-#define DEBUG 0
+#define DEBUG 1
#endif
@@ -59,11 +59,10 @@ DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new U
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);
synctimer = new QTimer(this);
- synctimer->setInterval(1000); // 1 second pause (combine simultaneous signals from the watcher)
+ synctimer->setInterval(300); // 300 millisecond pause (combine simultaneous signals from the watcher)
synctimer->setSingleShot(true);
//Now update the rest of the UI
canmodify = false; //initial value
@@ -306,10 +305,11 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
int numdirs = 0;
qint64 filebytes = 0;
//Setup the timer to see when we should process events
- QTimer updatetime;
+ /*QTimer updatetime;
updatetime.setInterval(1000); //1 second updates
updatetime.setSingleShot(true);
- updatetime.start();
+ updatetime.start();*/
+ QTime updatetime = QTime::currentTime().addMSecs(500);
if(DEBUG){ qDebug() << "Start Loop over items:" << time.elapsed(); }
for(int i=0; i<list.length(); i++){
if(stopload){ ui->actionStopLoad->setVisible(false); return; } //stop right now
@@ -430,7 +430,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
listWidget->scrollToItem(it);
}
}
- if(!updatetime.isActive()){ QApplication::processEvents(); updatetime.start(); }//keep the UI snappy while loading a directory
+ if(QTime::currentTime() > updatetime){ QApplication::processEvents(); updatetime = QTime::currentTime().addMSecs(500); }//keep the UI snappy while loading a directory
if(DEBUG){ qDebug() << " - item finished:" << i << time.elapsed(); }
}
tmpSel.clear();
@@ -572,7 +572,7 @@ void DirWidget::setupConnections(){
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(startSync(const QString &)) );
connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(startSync(const QString &)) ); //just in case
@@ -603,10 +603,7 @@ void DirWidget::startLoadThumbs(){
//This just runs through the dir and loads all the thumbnails as needed
if(needThumbs.isEmpty()){ return; }
needThumbs.removeDuplicates(); //just in case
- QTimer updatetime;
- updatetime.setInterval(1000); //1 second updates
- updatetime.setSingleShot(true);
- updatetime.start();
+ QTime updatetime = QTime::currentTime().addMSecs(500);
for(int i=0; i<needThumbs.length() && !stopload; i++){
if(showDetails){
//Use the tree widget
@@ -617,7 +614,7 @@ void DirWidget::startLoadThumbs(){
QListWidgetItem *it = listWidget->findItems(needThumbs[i], Qt::MatchExactly).first();
it->setIcon(QIcon( QPixmap(it->whatsThis().section("::::",1,100)).scaled(listWidget->iconSize(),Qt::IgnoreAspectRatio, Qt::FastTransformation) ) );
}
- if(!updatetime.isActive()){ QApplication::processEvents(); updatetime.start(); } //it has been a second - process events
+ if(QTime::currentTime() > updatetime){ QApplication::processEvents(); updatetime = QTime::currentTime().addMSecs(500); }//keep the UI snappy while loading a directory
}
}
@@ -953,10 +950,10 @@ void DirWidget::startSync(const QString &file){
//Update date_format based on user settings
if(file == sessionsettings_config_file){ setDateFormat(); }
else if(file == snapbasedir){ emit findSnaps(ID, normalbasedir); } //snapshot list changed
- else if(file == normalbasedir){
+ /*else if(file == normalbasedir){
if(synctimer->isActive()){ synctimer->stop(); } //already starting a sync
emit LoadDirectory(ID, normalbasedir); //Directory changed (new/removed files)
- }else{
+ }*/else{
//Some file in the directory got changed - start the time for a dir reload
// -- This prevents a directory from refreshing constantly if a file within the directory is changing all the time (such as a log file)
if(!synctimer->isActive()){ synctimer->start(); }
diff --git a/lumina-fm/widgets/DirWidget.h b/lumina-fm/widgets/DirWidget.h
index d9573150..799251f4 100644
--- a/lumina-fm/widgets/DirWidget.h
+++ b/lumina-fm/widgets/DirWidget.h
@@ -90,7 +90,7 @@ private:
DDTreeWidget *treeWidget;
//Keyboard Shortcuts
- QShortcut *copyFilesShort, *cutFilesShort, *pasteFilesShort, *deleteFilesShort, *refreshShort;
+ QShortcut *copyFilesShort, *cutFilesShort, *pasteFilesShort, *deleteFilesShort;
//Watcher to determine when the dir changes
QFileSystemWatcher *watcher;
QTimer *synctimer;
diff --git a/lumina-fm/widgets/DirWidget.ui b/lumina-fm/widgets/DirWidget.ui
index 68eb3274..1825cd0d 100644
--- a/lumina-fm/widgets/DirWidget.ui
+++ b/lumina-fm/widgets/DirWidget.ui
@@ -36,7 +36,88 @@
<layout class="QHBoxLayout" name="toolbar_layout"/>
</item>
<item row="3" column="0" colspan="2">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <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_new_file">
+ <property name="statusTip">
+ <string>Create a new file</string>
+ </property>
+ <property name="text">
+ <string>New File</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_new_dir">
+ <property name="statusTip">
+ <string>Create a new directory</string>
+ </property>
+ <property name="text">
+ <string>New Dir</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_goToImages">
+ <property name="statusTip">
+ <string>Add selected images to slideshow</string>
+ </property>
+ <property name="text">
+ <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>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>
<item>
<widget class="QLabel" name="label_status">
<property name="text">
@@ -47,70 +128,6 @@
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="tool_new_dir">
- <property name="statusTip">
- <string>Create a new directory</string>
- </property>
- <property name="text">
- <string>New Dir</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_new_file">
- <property name="statusTip">
- <string>Create a new file</string>
- </property>
- <property name="text">
- <string>New File</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="tool_goToImages">
- <property name="statusTip">
- <string>Add selected images to slideshow</string>
- </property>
- <property name="text">
- <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>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>
<item row="2" column="1">
bgstack15