1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-20 13:54:24 +02:00

Project structure refactoring

This commit is contained in:
2017-11-26 18:54:03 +01:00
parent 443b916301
commit 56e4c80999
182 changed files with 500 additions and 529 deletions

45
src/GUI/palette.cpp Normal file
View File

@ -0,0 +1,45 @@
#include "palette.h"
Palette::Palette(const QColor &color, qreal shift)
{
_h = 0; _s = 0; _v = 0; _a = 1.0;
setColor(color);
setShift(shift);
_state = _h;
}
void Palette::setColor(const QColor &color)
{
if (color.isValid())
color.getHsvF(&_h, &_s, &_v, &_a);
}
void Palette::setShift(qreal shift)
{
if (shift >= 0 && shift <= 1.0)
_shift = shift;
}
QColor Palette::nextColor()
{
QColor ret = QColor::fromHsvF(_state, _s, _v, _a);
_state += _shift;
_state -= (int) _state;
return ret;
}
void Palette::reset()
{
_state = _h;
}
QDebug operator<<(QDebug dbg, const Palette &palette)
{
dbg.nospace() << "Palette(" << palette.color() << ", " << palette.shift()
<< ")";
return dbg.space();
}