The macro defined namespaces confused the hell out of lupdate and more or less broke translations permanently. Looks like the only way we can do it is to have a hardcoded namespace, which goes against my instinct, but honestly how likely is it that we'll change the namespace anyway (I guess forks might want to do it, but that's their problem ;) )
88 lines
2.1 KiB
C++
88 lines
2.1 KiB
C++
/***
|
|
|
|
Olive - Non-Linear Video Editor
|
|
Copyright (C) 2020 Olive Team
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
#ifndef TIMELINESCALEDOBJECT_H
|
|
#define TIMELINESCALEDOBJECT_H
|
|
|
|
#include <QWidget>
|
|
|
|
#include "common/rational.h"
|
|
|
|
namespace olive {
|
|
|
|
class TimelineScaledObject
|
|
{
|
|
public:
|
|
TimelineScaledObject();
|
|
virtual ~TimelineScaledObject() = default;
|
|
|
|
void SetTimebase(const rational &timebase);
|
|
|
|
const rational& timebase() const;
|
|
const double& timebase_dbl() const;
|
|
|
|
static rational SceneToTime(const double &x, const double& x_scale, const rational& timebase, bool round = false);
|
|
|
|
const double& GetScale() const;
|
|
|
|
void SetScale(const double& scale);
|
|
|
|
void SetScaleFromDimensions(double viewport_width, double content_width);
|
|
static double CalculateScaleFromDimensions(double viewport_sz, double content_sz);
|
|
static double CalculatePaddingFromDimensionScale(double viewport_sz);
|
|
|
|
double TimeToScene(const rational& time);
|
|
rational SceneToTime(const double &x, bool round = false);
|
|
|
|
protected:
|
|
virtual void TimebaseChangedEvent(const rational&){}
|
|
|
|
virtual void ScaleChangedEvent(const double&){}
|
|
|
|
void SetMaximumScale(const double& max);
|
|
|
|
void SetMinimumScale(const double& min);
|
|
|
|
private:
|
|
rational timebase_;
|
|
|
|
double timebase_dbl_;
|
|
|
|
double scale_;
|
|
|
|
double min_scale_;
|
|
|
|
double max_scale_;
|
|
|
|
static const int kCalculateDimensionsPadding;
|
|
|
|
};
|
|
|
|
class TimelineScaledWidget : public QWidget, public TimelineScaledObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
TimelineScaledWidget(QWidget* parent = nullptr);
|
|
};
|
|
|
|
}
|
|
|
|
#endif // TIMELINESCALEDOBJECT_H
|