aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/MainUI.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/MainUI.cpp44
1 files changed, 33 insertions, 11 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
index 9962a4bf..73d1420a 100644
--- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
@@ -22,10 +22,10 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
//qRegisterMetaType<QFileInfoList>("QFileInfoList");
qRegisterMetaType< LFileInfoList >("LFileInfoList");
//just to silence/fix some Qt connect warnings in QtConcurrent
- //qRegisterMetaType< QVector<int> >("QVector<int>");
+ //qRegisterMetaType< QVector<int> >("QVector<int>");
//qRegisterMetaType< QList<QPersistentModelIndex> >("QList<QPersistentModelIndex>");
waitingToClose = false;
-
+
ui->setupUi(this);
if(DEBUG){ qDebug() << "Initilization:"; }
settings = LUtils::openSettings("lumina-desktop", "lumina-fm", this);
@@ -35,7 +35,7 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize();
if(!orig.isEmpty() && orig.isValid()){
//Make sure the old size is larger than the default size hint
if(orig.width() < this->sizeHint().width()){ orig.setWidth(this->sizeHint().width()); }
- if(orig.height() < this->sizeHint().height()){ orig.setHeight(this->sizeHint().height()); }
+ if(orig.height() < this->sizeHint().height()){ orig.setHeight(this->sizeHint().height()); }
//Also ensure the old size is smaller than the current screen size
QSize screen = QApplication::desktop()->availableGeometry(this).size();
if(orig.width() > screen.width()){ orig.setWidth(screen.width()); }
@@ -94,6 +94,7 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize();
nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this);
togglehiddenfilesShort = new QShortcut( QKeySequence(tr("Ctrl+H")), this);
focusDirWidgetShort = new QShortcut( QKeySequence(tr("Ctrl+L")), this);
+ toggledirtreepaneShort = new QShortcut( QKeySequence(tr("Ctrl+P")), this);
//Finish loading the interface
workThread->start();
@@ -134,7 +135,7 @@ void MainUI::OpenDirs(QStringList dirs){
if(DEBUG){ qDebug() << "Open Directory:" << dirs[i]; }
///Get a new Unique ID
int id = 0;
- for(int j=0; j<DWLIST.length(); j++){
+ 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
@@ -157,7 +158,7 @@ void MainUI::OpenDirs(QStringList dirs){
connect(DW, SIGNAL(PasteFiles(QString,QStringList)), this, SLOT(PasteFiles(QString, QStringList)) );
connect(DW, SIGNAL(CloseBrowser(QString)), this, SLOT(CloseBrowser(QString)) );
connect(DW, SIGNAL(TabNameChanged(QString,QString)), this, SLOT(TabNameChanged(QString, QString)) );
- //Now create the tab for this
+ //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) );
@@ -175,12 +176,13 @@ void MainUI::OpenDirs(QStringList dirs){
tabBar->setCurrentIndex(index);
}
}*/
-
+
//Initialize the widget with the proper settings
DW->setShowDetails(radio_view_details->isChecked());
DW->setThumbnailSize(settings->value("iconsize", 32).toInt());
DW->showHidden( ui->actionView_Hidden_Files->isChecked() );
DW->showThumbnails( ui->actionShow_Thumbnails->isChecked() );
+ DW->showDirTreePane( ui->actionView_showDirTreePane->isChecked() );
//Now load the directory
DW->ChangeDir(dirs[i]); //kick off loading the directory info
}
@@ -200,7 +202,7 @@ void MainUI::OpenDirs(QStringList dirs){
void MainUI::setupIcons(){
this->setWindowIcon( LXDG::findIcon("Insight-FileManager","") );
-
+
//Setup all the icons using libLumina
// File menu
ui->actionNew_Window->setIcon( LXDG::findIcon("window-new","") );
@@ -254,6 +256,8 @@ void MainUI::setupConnections(){
connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) );
connect(togglehiddenfilesShort, SIGNAL(activated()), this, SLOT( togglehiddenfiles() ) );
connect(focusDirWidgetShort, SIGNAL(activated()), this, SLOT( focusDirWidget() ) );
+ connect(toggledirtreepaneShort, SIGNAL(activated()), this, SLOT( toggleDirTreePane() ) );
+
}
void MainUI::focusDirWidget()
@@ -270,6 +274,14 @@ void MainUI::togglehiddenfiles()
on_actionView_Hidden_Files_triggered();
}
+void MainUI::toggleDirTreePane()
+{
+ //change setChecked to inverse value
+ ui->actionView_Hidden_Files->setChecked( !settings->value("showdirtree", true).toBool() );
+ // then trigger function
+ on_actionView_showDirTreePane_triggered();
+}
+
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
@@ -277,6 +289,9 @@ void MainUI::loadSettings(){
on_actionView_Hidden_Files_triggered(); //make sure to update the models too
ui->actionShow_Thumbnails->setChecked( settings->value("showthumbnails",true).toBool());
on_actionShow_Thumbnails_triggered(); //make sure to update models too
+ ui->actionView_showDirTreePane->setChecked( settings->value("showdirtree", false).toBool());
+ on_actionView_showDirTreePane_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() );
@@ -289,7 +304,7 @@ void MainUI::loadSettings(){
//bool usetabs = (settings->value("groupmode","tabs").toString()=="tabs");
//if(usetabs){ radio_view_tabs->setChecked(true); }
// else{ radio_view_cols->setChecked(true); }
-
+
}
void MainUI::RebuildBookmarksMenu(){
@@ -344,7 +359,7 @@ void MainUI::RebuildDeviceMenu(){
//Add filesystem type to the label
label = QString(tr("%1 (Type: %2)")).arg(label, fs);
}
- QAction *act = new QAction(label,this);
+ 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
@@ -365,7 +380,7 @@ DirWidget* MainUI::FindActiveBrowser(){
//Get the current tab ID to start with
QString cur = tabBar->tabWhatsThis(tabBar->currentIndex());
//if(cur.startsWith("#")){ cur.clear(); } //multimedia/player tab open
-
+
if(DWLIST.length()==1){
//Only 1 browser open - use it
curB = DWLIST[0];
@@ -382,7 +397,6 @@ DirWidget* MainUI::FindActiveBrowser(){
for(int i=0; i<DWLIST.length(); i++){
if(DWLIST[i]->isAncestorOf(focus)){ curB = DWLIST[i]; break; } //This browser has focus
}
-
}else{
//Non-Browser in focus - use the fallback below
}
@@ -476,6 +490,14 @@ void MainUI::on_actionView_Hidden_Files_triggered(){
}
+void MainUI::on_actionView_showDirTreePane_triggered(){
+ //worker->showdirtree = ui->actionView_showDirTreePane->isChecked();
+ settings->setValue("showdirtree", ui->actionView_showDirTreePane->isChecked());
+//Re-load the current browsers
+
+}
+
+
/*void MainUI::on_actionShow_Action_Buttons_triggered(){
bool show = ui->actionShow_Action_Buttons->isChecked();
settings->setValue("showactions", show);
bgstack15