Skip to content

Commit

Permalink
Fixed disk manager used space calculation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Feb 25, 2018
1 parent d64a84c commit fbe902a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Source/IpFreely.pro
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ else {
QMAKE_CXXFLAGS += -std=c++14

# Set version info for library.
VERSION = 1.1.2
VERSION = 1.1.3

INCLUDEPATH += /usr/local/include \
/home/duncan/projects/ThirdParty \
Expand Down
8 changes: 4 additions & 4 deletions Source/IpFreely.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
IDI_ICON1 ICON DISCARDABLE "IpFreely.ico"

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,1,2,0
PRODUCTVERSION 1,1,2,0
FILEVERSION 1,1,3,0
PRODUCTVERSION 1,1,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -25,11 +25,11 @@ VS_VERSION_INFO VERSIONINFO
BEGIN
VALUE "CompanyName", "~\0"
VALUE "FileDescription", "IP Freely (IP/Web camera stream viewer and recorder)\0"
VALUE "FileVersion", "1.1.2.0\0"
VALUE "FileVersion", "1.1.3.0\0"
VALUE "LegalCopyright", "Copyright 2018 Duncan Crutchley\0"
VALUE "OriginalFilename", "IpFreely\0"
VALUE "ProductName", "IpFreely\0"
VALUE "ProductVersion", "1.1.2.0\0"
VALUE "ProductVersion", "1.1.3.0\0"
END
END
BLOCK "VarFileInfo"
Expand Down
12 changes: 8 additions & 4 deletions Source/IpFreelyDiskSpaceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ void IpFreelyDiskSpaceManager::CheckUsedDiskSpace()
{
QStorageInfo info(QString::fromStdString(m_saveFolderPath));

auto percentUsed = static_cast<int>((static_cast<double>(info.bytesAvailable()) * 100.0) /
static_cast<double>(info.bytesTotal()));
auto percentUsed =
static_cast<int>(100.0 * (1.0 - (static_cast<double>(info.bytesAvailable()) /
static_cast<double>(info.bytesTotal()))));

if (percentUsed > m_maxPercentUsedSpace)
{
DEBUG_MESSAGE_EX_INFO("Percentage disk space used is too great ("
<< percentUsed << "%), will attempt to delete oldest data.");
<< percentUsed
<< "%), will attempt to delete oldest data.");

if (!DeleteOldestRecording())
{
Expand All @@ -119,7 +121,9 @@ void IpFreelyDiskSpaceManager::CheckNumDaysDataStored()
while (m_subDirs.size() > static_cast<size_t>(m_maxNumDaysToStore))
{
DEBUG_MESSAGE_EX_INFO("Too many days data found on disk. Expected: "
<< m_maxNumDaysToStore << " but found: " << m_subDirs.size()
<< m_maxNumDaysToStore
<< " but found: "
<< m_subDirs.size()
<< ". Will attempt to delete oldest data.");

if (!DeleteOldestRecording())
Expand Down
2 changes: 1 addition & 1 deletion Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ std::string GetAppVersion(const std::string& appFilePath)
return appVersion;
}
#else
#define IPFREELY_VERSION "1.1.2.0"
#define IPFREELY_VERSION "1.1.3.0"
#endif

int main(int argc, char* argv[])
Expand Down

0 comments on commit fbe902a

Please sign in to comment.