2012-01-07 16:53:23 +00:00
|
|
|
#ifndef _PAYSAGES_QT_TOOLS_H_
|
|
|
|
#define _PAYSAGES_QT_TOOLS_H_
|
|
|
|
|
|
|
|
#include <QColor>
|
2012-06-02 14:17:01 +00:00
|
|
|
#include <QDialog>
|
2013-04-17 12:29:51 +00:00
|
|
|
#include <QDir>
|
2012-01-07 16:53:23 +00:00
|
|
|
|
2013-04-17 12:29:51 +00:00
|
|
|
#include "rendering/shared/types.h"
|
|
|
|
#include "rendering/tools/color.h"
|
2012-01-07 16:53:23 +00:00
|
|
|
|
|
|
|
static inline QColor colorToQColor(Color color)
|
|
|
|
{
|
2012-01-17 20:54:14 +00:00
|
|
|
colorNormalize(&color);
|
2012-01-07 16:53:23 +00:00
|
|
|
return QColor(color.r * 255.0, color.g * 255.0, color.b * 255.0, color.a * 255.0);
|
|
|
|
}
|
|
|
|
|
2013-04-17 12:29:51 +00:00
|
|
|
static inline QString getDataPath(QString path)
|
|
|
|
{
|
2013-06-16 17:06:10 +00:00
|
|
|
QFile datafile(QDir("/usr/share/paysages3d/").absoluteFilePath(path));
|
|
|
|
if (datafile.exists())
|
|
|
|
{
|
|
|
|
return datafile.fileName();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return QDir("./data").absoluteFilePath(path);
|
|
|
|
}
|
2013-04-17 12:29:51 +00:00
|
|
|
}
|
|
|
|
|
2013-05-05 13:37:06 +00:00
|
|
|
QString getHumanMemory(qint64 memused);
|
|
|
|
|
2012-06-02 14:17:01 +00:00
|
|
|
class DialogWithPreview:public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DialogWithPreview(QWidget* parent);
|
2013-01-19 22:42:50 +00:00
|
|
|
|
2012-06-02 14:17:01 +00:00
|
|
|
protected:
|
|
|
|
virtual bool event(QEvent* event);
|
|
|
|
};
|
|
|
|
|
2012-06-02 09:46:24 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
#include <QDebug>
|
|
|
|
static inline void logDebug(QString string)
|
|
|
|
{
|
|
|
|
qDebug() << string;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define logDebug(_x_) ;
|
|
|
|
#endif
|
|
|
|
|
2012-01-24 13:16:20 +00:00
|
|
|
#endif
|