Skip to content
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

rewrite FileSystemInfo #485

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

ulmus-scott
Copy link
Contributor

This is inspired by #438 , in particular moving the various functions in mythcoreutil.h to more appropriately named files.

Checklist

Also, for FileSystemInfo:
combine PopulateDiskSpace() and PopulateFSProp() into refresh() with comment from
getDiskSpace().

inline constructors and use compiler default copy assignment and copy constructor.

Add a shorter constructor to replace getDiskSpace().

Add doxygen comments.

Note: ZMServer::getDiskSpace() has been left as is, since zmserver is standard C++
only. i.e. does not use Qt.
Use for each loop.

The removed if statement is misleading, since the first directory could be empty,
and if all others are as well, it will be returned even though it is not usable.
I'm not sure what the existing comment was about, since MythTV never increases
m_used.
instead of duplicating its code.
add type alias FileSystemInfoList

FileServerHandler::QueryFileSystems():
 * QDir ignores (or will resolve) redunant separators to the same directory,
   so removing a trailing "/" is unnecessary.
 * The comment is from MainServer::BackendQueryDiskSpace() which duplicated the
   code (or vice versa).
in MainServer::BackendQueryDiskSpace()

The only difference with FileSystemInfo::Consolidate() was the use of
GetfsID() instead of starting from 0 every time.  I'm not sure why it
wasn't removed when the class was created in 65e877a.

The only change is that the m_fsid may not be the same for the same
hostname and path on subsequent calls to BackendQueryDiskSpace(),
which would be a wierd thing the rely on especially since this was the only
function that did that.
in MainServer::BackendQueryDiskSpace()
QList is a terrible container.  It is essentially a vector of pointers.

Use QVector instead, which should be the default Qt container.
based on namespace or class.
for getDiskSpace() removal and FileSystemInfo changes.
@@ -95,6 +95,49 @@ bool FileSystemInfo::FromStringList(QStringList::const_iterator &it,
return true;
}

bool FileSystemInfo::refresh()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure the entire of this can be done with Qt's QStorageInfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants