mirror of
https://github.com/MaurycyLiebner/enve.git
synced 2024-12-20 15:42:16 +00:00
Compare commits
No commits in common. "6dd0f78f5137a8a45c8962567ebf925543feddf8" and "c39be6f405f7cf08151aabbcd7e1a6988b6f27e3" have entirely different histories.
6dd0f78f51
...
c39be6f405
@ -20,7 +20,6 @@
|
||||
#include "Private/Tasks/taskscheduler.h"
|
||||
#include "Private/Tasks/complextask.h"
|
||||
#include "conncontextptr.h"
|
||||
#include "memoryhandler.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QLocale>
|
||||
@ -147,13 +146,6 @@ UsageWidget::UsageWidget(QWidget * const parent) : QStatusBar(parent) {
|
||||
|
||||
mRamLabel = new QLabel(this);
|
||||
|
||||
const auto clearRamButton = new QPushButton("clear memory", this);
|
||||
connect(clearRamButton, &QPushButton::clicked,
|
||||
this, []() {
|
||||
const auto m = MemoryHandler::sInstance;
|
||||
m->clearMemory();
|
||||
});
|
||||
|
||||
addPermanentWidget(gpuLabel);
|
||||
addPermanentWidget(mGpuBar);
|
||||
|
||||
@ -168,8 +160,6 @@ UsageWidget::UsageWidget(QWidget * const parent) : QStatusBar(parent) {
|
||||
|
||||
addPermanentWidget(mRamLabel);
|
||||
|
||||
addPermanentWidget(clearRamButton);
|
||||
|
||||
setThreadsTotal(QThread::idealThreadCount());
|
||||
|
||||
connect(TaskScheduler::instance(), &TaskScheduler::hddUsageChanged,
|
||||
@ -210,7 +200,7 @@ void UsageWidget::setTotalRam(const qreal totalRamMB) {
|
||||
}
|
||||
|
||||
void UsageWidget::addComplexTask(ComplexTask * const task) {
|
||||
for(const auto wid : qAsConst(mTaskWidgets)) {
|
||||
for(const auto wid : mTaskWidgets) {
|
||||
if(wid->isHidden()) {
|
||||
return wid->setComplexTask(task);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ void MemoryChecker::checkMemory() {
|
||||
} else if(procFreeKB.fValue < 0) {
|
||||
emit handleMemoryState(LOW_MEMORY_STATE, longB(-procFreeKB));
|
||||
mLastMemoryState = LOW_MEMORY_STATE;
|
||||
} else/* if(mLastMemoryState != NORMAL_MEMORY_STATE)*/ {
|
||||
} else if(mLastMemoryState != NORMAL_MEMORY_STATE) {
|
||||
emit handleMemoryState(NORMAL_MEMORY_STATE, longB(0));
|
||||
mLastMemoryState = NORMAL_MEMORY_STATE;
|
||||
}
|
||||
|
@ -60,10 +60,6 @@ MemoryHandler::~MemoryHandler() {
|
||||
delete mMemoryChecker;
|
||||
}
|
||||
|
||||
void MemoryHandler::clearMemory() {
|
||||
freeMemory(NORMAL_MEMORY_STATE, longB(std::numeric_limits<qint64>::max()));
|
||||
}
|
||||
|
||||
MemoryState MemoryHandler::sMemoryState() {
|
||||
return sInstance->mMemoryState;
|
||||
}
|
||||
@ -94,11 +90,11 @@ void MemoryHandler::freeMemory(const MemoryState newState,
|
||||
const auto cont = mDataHandler.takeFirst();
|
||||
memToFree -= cont->free_RAM_k();
|
||||
}
|
||||
if(newState == CRITICAL_MEMORY_STATE ||
|
||||
memToFree > 0) {
|
||||
mMemoryState = CRITICAL_MEMORY_STATE;
|
||||
if(newState == CRITICAL_MEMORY_STATE) {
|
||||
emit enteredCriticalState();
|
||||
emit allMemoryUsed();
|
||||
} else if(memToFree > 0) {
|
||||
emit allMemoryUsed();
|
||||
}
|
||||
emit memoryFreed();
|
||||
}
|
||||
|
@ -26,8 +26,6 @@ public:
|
||||
explicit MemoryHandler(QObject * const parent = nullptr);
|
||||
~MemoryHandler();
|
||||
|
||||
void clearMemory();
|
||||
|
||||
static MemoryHandler *sInstance;
|
||||
static MemoryState sMemoryState();
|
||||
signals:
|
||||
|
@ -89,11 +89,11 @@ void ImageLoader::process() {
|
||||
}
|
||||
|
||||
void ImageLoader::afterProcessing() {
|
||||
if(mTargetHandler) mTargetHandler->replaceImage(mImage);
|
||||
mTargetHandler->replaceImage(mImage);
|
||||
}
|
||||
|
||||
void ImageLoader::afterCanceled() {
|
||||
if(mTargetHandler) mTargetHandler->replaceImage(mImage);
|
||||
mTargetHandler->replaceImage(mImage);
|
||||
}
|
||||
|
||||
void OraLoader::process() {
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
void afterProcessing();
|
||||
void afterCanceled();
|
||||
protected:
|
||||
const qptr<ImageFileDataHandler> mTargetHandler;
|
||||
ImageFileDataHandler * const mTargetHandler;
|
||||
const QString mFilePath;
|
||||
sk_sp<SkImage> mImage;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user