-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace MDir with mixxx::FileInfo/FileAccess #3744
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dcc6f9e
Replace MDir with mixxx::FileInfo/FileAccess
uklotzde b6e4a2c
FileAccess: Add documentation
uklotzde 764c285
Replace auto with explicit type
uklotzde 9c47831
Explicitly distinguish between file/dir security tokens
uklotzde bf44876
CMake: Public platform defines
uklotzde fd83957
DirectoryDAO: Test that symbolic links are handled correctly
uklotzde a7725cf
Fix typo
uklotzde feb5ac4
Merge branch 'main' of git@github.com:mixxxdj/mixxx.git into fileaccess
uklotzde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,15 +4,15 @@ | |||||
|
||||||
#pragma once | ||||||
|
||||||
#include <QThread> | ||||||
#include <QMutex> | ||||||
#include <QWaitCondition> | ||||||
#include <QStandardItem> | ||||||
#include <QList> | ||||||
#include <QMutex> | ||||||
#include <QSharedPointer> | ||||||
#include <QStandardItem> | ||||||
#include <QThread> | ||||||
#include <QWaitCondition> | ||||||
#include <QWeakPointer> | ||||||
|
||||||
#include "util/file.h" | ||||||
#include "util/fileaccess.h" | ||||||
|
||||||
// This class is a singleton and represents a thread | ||||||
// that is used to read ID3 metadata | ||||||
|
@@ -30,7 +30,7 @@ class BrowseThread : public QThread { | |||||
Q_OBJECT | ||||||
public: | ||||||
virtual ~BrowseThread(); | ||||||
void executePopulation(const MDir& path, BrowseTableModel* client); | ||||||
void executePopulation(mixxx::FileAccess path, BrowseTableModel* client); | ||||||
void run(); | ||||||
static BrowseThreadPointer getInstanceRef(); | ||||||
|
||||||
|
@@ -49,7 +49,7 @@ class BrowseThread : public QThread { | |||||
|
||||||
// You must hold m_path_mutex to touch m_path or m_model_observer | ||||||
QMutex m_path_mutex; | ||||||
MDir m_path; | ||||||
mixxx::FileAccess m_path; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't want to introduce many unrelated changes just by renaming things. And I especially try to avoid touching this browse stuff. |
||||||
BrowseTableModel* m_model_observer; | ||||||
|
||||||
static QWeakPointer<BrowseThread> m_weakInstanceRef; | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks confusing, because one may think this refrences a file, but it is a directory. Do you have an idea to improve the naming?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QFileInfo also could reference everything file/dir/symlink, we follow it. This naming is at least consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know. Unfortunately this makes the usage code harder to read.
Can we rename m_pPath to something more specific, to improve the situation?
Do we use the security tokens for single files? Looking into the implementation, there are different call stacks for files and directories. Maybe we can inherit a file and a dir version and accept some code duplications for some extra safety
What are your future plans with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nothing that blocks this PR ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just noticed this. The special
QDir
overloads inSandbox
are not needed an can be removed. We can switch entirely tomixxx::FileInfo
. Only the browse view seems to be affected.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inheriting does not make sense for this use case. You can only know at runtime if a file system reference is a file, directory, or symlink.
The equivalent of
QFileInfo
in Rust would bestd::path::Path
/std::path::PathBuf
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed that
Sandbox
handles directories differently. Converting back to draft until I have checked that nothing got mixed up here. Thanks for reviewing so far.