data: Save timestamp of project indexing and show it in overview
This commit is contained in:
@@ -69,6 +69,12 @@ void CodeController::handleMessage(MessageActivateAll* message)
|
||||
ErrorCountInfo errorCount = m_storageAccess->getErrorCount();
|
||||
|
||||
ss << "\n";
|
||||
if (stats.timestamp.isValid())
|
||||
{
|
||||
ss << "\tlast indexed: " + stats.timestamp.toString() + "\n";
|
||||
ss << "\n";
|
||||
}
|
||||
|
||||
ss << "\t" + std::to_string(stats.fileCount) + " files";
|
||||
ss << (stats.completedFileCount != stats.fileCount ? " (" + std::to_string(stats.completedFileCount) + " complete)" : "") + "\n";
|
||||
ss << "\t" + std::to_string(stats.fileLOCCount) + " lines of code\n";
|
||||
|
||||
@@ -559,6 +559,7 @@ void PersistentStorage::optimizeMemory()
|
||||
TRACE();
|
||||
|
||||
m_sqliteIndexStorage.setVersion();
|
||||
m_sqliteIndexStorage.setTime();
|
||||
m_sqliteIndexStorage.optimizeMemory();
|
||||
|
||||
m_sqliteBookmarkStorage.setVersion();
|
||||
@@ -1411,6 +1412,8 @@ StorageStats PersistentStorage::getStorageStats() const
|
||||
stats.completedFileCount = m_sqliteIndexStorage.getCompletedFileCount();
|
||||
stats.fileLOCCount = m_sqliteIndexStorage.getFileLineSum();
|
||||
|
||||
stats.timestamp = m_sqliteIndexStorage.getTime();
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "SqliteStorage.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/TimePoint.h"
|
||||
|
||||
SqliteStorage::SqliteStorage(const FilePath& dbFilePath)
|
||||
: m_dbFilePath(dbFilePath.canonical())
|
||||
@@ -119,6 +120,16 @@ void SqliteStorage::setVersion()
|
||||
setApplicationVersion();
|
||||
}
|
||||
|
||||
void SqliteStorage::setTime()
|
||||
{
|
||||
insertOrUpdateMetaValue("timestamp", TimePoint::now().toString());
|
||||
}
|
||||
|
||||
TimePoint SqliteStorage::getTime() const
|
||||
{
|
||||
return TimePoint(getMetaValue("timestamp"));
|
||||
}
|
||||
|
||||
void SqliteStorage::setupMetaTable()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/Version.h"
|
||||
|
||||
class TimePoint;
|
||||
|
||||
class SqliteStorage
|
||||
{
|
||||
public:
|
||||
@@ -38,6 +40,8 @@ public:
|
||||
bool isIncompatible() const;
|
||||
|
||||
void setVersion();
|
||||
void setTime();
|
||||
TimePoint getTime() const;
|
||||
|
||||
protected:
|
||||
void setupMetaTable();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef STORAGE_STATS_H
|
||||
#define STORAGE_STATS_H
|
||||
|
||||
#include "utility/TimePoint.h"
|
||||
|
||||
struct StorageStats
|
||||
{
|
||||
StorageStats()
|
||||
@@ -17,6 +19,8 @@ struct StorageStats
|
||||
size_t fileCount;
|
||||
size_t completedFileCount;
|
||||
size_t fileLOCCount;
|
||||
|
||||
TimePoint timestamp;
|
||||
};
|
||||
|
||||
#endif // STORAGE_STATS_H
|
||||
|
||||
Reference in New Issue
Block a user