Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
cae5bef0
Commit
cae5bef0
authored
Apr 28, 2011
by
dt_
Browse files
Revert "FileWatcher: Use Utils::FileSystemWatcher in Core::FileManager."
This reverts commit
4a098509
.
parent
a150d5f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/filemanager.cpp
View file @
cae5bef0
...
...
@@ -45,7 +45,6 @@
#include
<utils/qtcassert.h>
#include
<utils/pathchooser.h>
#include
<utils/reloadpromptutils.h>
#include
<utils/filesystemwatcher.h>
#include
<QtCore/QSettings>
#include
<QtCore/QFileInfo>
...
...
@@ -114,9 +113,8 @@ struct FileState
struct
FileManagerPrivate
{
explicit
FileManagerPrivate
(
FileManager
*
q
,
QMainWindow
*
mw
);
void
watchFile
(
const
QString
&
f
);
void
watchLink
(
const
QString
&
f
);
QFileSystemWatcher
*
fileWatcher
();
QFileSystemWatcher
*
linkWatcher
();
static
FileManager
*
m_instance
;
QMap
<
QString
,
FileState
>
m_states
;
...
...
@@ -131,7 +129,7 @@ struct FileManagerPrivate {
QString
m_currentFile
;
QMainWindow
*
m_mainWindow
;
Utils
::
FileSystemWatcher
*
m_fileWatcher
;
// Delayed creation.
Q
FileSystemWatcher
*
m_fileWatcher
;
// Delayed creation.
QFileSystemWatcher
*
m_linkWatcher
;
// Delayed creation (only UNIX/if a link is seen).
bool
m_blockActivated
;
QString
m_lastVisitedDirectory
;
...
...
@@ -144,30 +142,28 @@ struct FileManagerPrivate {
IFile
*
m_blockedIFile
;
};
void
FileManagerPrivate
::
watchFile
(
const
QString
&
f
)
QFileSystemWatcher
*
FileManagerPrivate
::
fileWatcher
(
)
{
if
(
!
m_fileWatcher
)
{
m_fileWatcher
=
new
Utils
::
FileSystemWatcher
(
m_instance
);
m_fileWatcher
->
setObjectName
(
QLatin1String
(
"FileManagerWatcher"
));
m_fileWatcher
=
new
QFileSystemWatcher
(
m_instance
);
QObject
::
connect
(
m_fileWatcher
,
SIGNAL
(
fileChanged
(
QString
)),
m_instance
,
SLOT
(
changedFile
(
QString
)));
}
m_fileWatcher
->
addFile
(
f
,
Utils
::
FileSystemWatcher
::
WatchAllChanges
)
;
return
m_fileWatcher
;
}
void
FileManagerPrivate
::
watchLink
(
const
QString
&
f
)
QFileSystemWatcher
*
FileManagerPrivate
::
linkWatcher
(
)
{
#ifdef Q_OS_UNIX
if
(
!
m_linkWatcher
)
{
// Use a different file watcher engine for links on UNIX
m_linkWatcher
=
new
QFileSystemWatcher
(
m_instance
);
m_linkWatcher
->
setObjectName
(
QLatin1String
(
"_qt_autotest_force_engine_poller"
));
QObject
::
connect
(
m_linkWatcher
,
SIGNAL
(
fileChanged
(
QString
)),
m_instance
,
SLOT
(
changedFile
(
QString
)));
}
m_linkWatcher
->
addPath
(
f
)
;
return
m_linkWatcher
;
#else
watchFile
(
f
);
return
fileWatcher
(
);
#endif
}
...
...
@@ -270,9 +266,9 @@ void FileManager::addFileInfo(const QString &fileName, IFile *file, bool isLink)
d
->
m_states
.
insert
(
fileName
,
Internal
::
FileState
());
if
(
isLink
)
d
->
watchLink
(
fileName
);
d
->
linkWatcher
()
->
addPath
(
fileName
);
else
d
->
watchFile
(
fileName
);
d
->
fileWatcher
()
->
addPath
(
fileName
);
}
d
->
m_states
[
fileName
].
lastUpdatedState
.
insert
(
file
,
state
);
}
...
...
@@ -357,8 +353,8 @@ void FileManager::removeFileInfo(IFile *file)
continue
;
d
->
m_states
[
fileName
].
lastUpdatedState
.
remove
(
file
);
if
(
d
->
m_states
.
value
(
fileName
).
lastUpdatedState
.
isEmpty
())
{
if
(
d
->
m_fileWatcher
&&
d
->
m_fileWatcher
->
watchesFile
(
fileName
))
d
->
m_fileWatcher
->
remove
File
(
fileName
);
if
(
d
->
m_fileWatcher
&&
d
->
m_fileWatcher
->
files
().
contains
(
fileName
))
d
->
m_fileWatcher
->
remove
Path
(
fileName
);
if
(
d
->
m_linkWatcher
&&
d
->
m_linkWatcher
->
files
().
contains
(
fileName
))
d
->
m_linkWatcher
->
removePath
(
fileName
);
d
->
m_states
.
remove
(
fileName
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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