2012-06-02 14:17:01 +00:00
|
|
|
#include "tools.h"
|
|
|
|
|
|
|
|
#include <QEvent>
|
|
|
|
#include "basepreview.h"
|
|
|
|
|
|
|
|
DialogWithPreview::DialogWithPreview(QWidget* parent) : QDialog(parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DialogWithPreview::event(QEvent* event)
|
|
|
|
{
|
|
|
|
if (event->type() == QEvent::WindowActivate)
|
|
|
|
{
|
|
|
|
BasePreview::reviveAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
return QDialog::event(event);
|
|
|
|
}
|
2013-05-05 13:37:06 +00:00
|
|
|
|
|
|
|
QString getHumanMemory(qint64 memused)
|
|
|
|
{
|
|
|
|
if (memused >= 1024)
|
|
|
|
{
|
|
|
|
memused /= 1024;
|
|
|
|
if (memused >= 1024)
|
|
|
|
{
|
|
|
|
memused /= 1024;
|
|
|
|
if (memused >= 1024)
|
|
|
|
{
|
|
|
|
memused /= 1024;
|
|
|
|
return QObject::tr("%1 GB").arg(memused);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return QObject::tr("%1 MB").arg(memused);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return QObject::tr("%1 kB").arg(memused);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return QObject::tr("%1 B").arg(memused);
|
|
|
|
}
|
|
|
|
}
|