Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
4a319366
Commit
4a319366
authored
Jan 14, 2010
by
Christophe Courtaut
Committed by
root
Jan 14, 2010
Browse files
Save the last used path in import dialog
parent
7ddb905e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Gui/import/ImportController.cpp
View file @
4a319366
...
...
@@ -29,6 +29,7 @@
#include
"Library.h"
#include
<QPalette>
#include
<QSettings>
#include
<QTime>
ImportController
::
ImportController
(
QWidget
*
parent
)
:
...
...
@@ -57,9 +58,12 @@ ImportController::ImportController(QWidget *parent) :
m_filesModel
->
setNameFilters
(
filters
);
Library
::
getInstance
()
->
setFilter
(
filters
);
restoreCurrentPath
();
m_ui
->
treeView
->
setModel
(
m_filesModel
);
m_ui
->
treeView
->
setRootIndex
(
m_filesModel
->
index
(
QDir
::
rootPath
()
)
);
m_ui
->
treeView
->
setCurrentIndex
(
m_filesModel
->
index
(
QDir
::
homePath
()
)
);
m_ui
->
treeView
->
setCurrentIndex
(
m_filesModel
->
index
(
m_currentlyWatchedDir
)
);
m_ui
->
treeView
->
setExpanded
(
m_ui
->
treeView
->
currentIndex
()
,
true
);
m_ui
->
treeView
->
setColumnHidden
(
1
,
true
);
m_ui
->
treeView
->
setColumnHidden
(
2
,
true
);
...
...
@@ -67,8 +71,7 @@ ImportController::ImportController(QWidget *parent) :
m_ui
->
forwardButton
->
setEnabled
(
false
);
m_fsWatcher
=
new
QFileSystemWatcher
();
m_fsWatcher
->
addPath
(
QDir
::
homePath
()
);
m_currentlyWatchedDir
=
QDir
::
homePath
();
m_fsWatcher
->
addPath
(
m_currentlyWatchedDir
);
connect
(
m_fsWatcher
,
SIGNAL
(
directoryChanged
(
QString
)
),
m_filesModel
,
SLOT
(
refresh
()
)
);
...
...
@@ -250,6 +253,7 @@ ImportController::treeViewClicked( const QModelIndex& index )
m_fsWatcher
->
removePath
(
m_currentlyWatchedDir
);
m_currentlyWatchedDir
=
m_filesModel
->
filePath
(
index
);
m_fsWatcher
->
addPath
(
m_filesModel
->
filePath
(
index
)
);
saveCurrentPath
();
}
m_ui
->
forwardButton
->
setEnabled
(
true
);
}
...
...
@@ -340,3 +344,20 @@ ImportController::restoreContext()
m_currentUuid
=
m_savedUuid
;
m_controllerSwitched
=
false
;
}
void
ImportController
::
saveCurrentPath
()
{
QSettings
s
;
s
.
setValue
(
"ImportPreviouslySelectPath"
,
m_currentlyWatchedDir
);
s
.
sync
();
}
void
ImportController
::
restoreCurrentPath
()
{
QSettings
s
;
QVariant
path
=
s
.
value
(
"ImportPreviouslySelectPath"
,
QDir
::
homePath
()
);
QFileInfo
info
=
path
.
toString
();
m_currentlyWatchedDir
=
info
.
absoluteFilePath
();
}
src/Gui/import/ImportController.h
View file @
4a319366
...
...
@@ -64,6 +64,8 @@ class ImportController : public QDialog
void
changeEvent
(
QEvent
*
e
);
private:
void
saveCurrentPath
();
void
restoreCurrentPath
();
Ui
::
ImportController
*
m_ui
;
PreviewWidget
*
m_preview
;
StackViewController
*
m_stackNav
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment