//
// C++ Implementation: woverview
//
// Description:
//
//
// Author: Tue Haste Andersen <haste@diku.dk>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "woverview.h"
#include <QBrush>
#include <QMimeData>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QPainter>
#include <QUrl>
#include <QtDebug>
#include "analyzer/analyzerprogress.h"
#include "control/controlobject.h"
#include "control/controlproxy.h"
#include "engine/engine.h"
#include "mixer/playermanager.h"
#include "preferences/colorpalettesettings.h"
#include "track/track.h"
#include "util/color/color.h"
#include "util/compatibility.h"
#include "util/dnd.h"
#include "util/duration.h"
#include "util/math.h"
#include "util/painterscope.h"
#include "util/timer.h"
#include "waveform/waveform.h"
#include "waveform/waveformwidgetfactory.h"
#include "widget/controlwidgetconnection.h"
#include "wskincolor.h"
WOverview::WOverview(
const QString& group,
PlayerManager* pPlayerManager,
UserSettingsPointer pConfig,
QWidget* parent)
: WWidget(parent),
m_actualCompletion(0),
m_pixmapDone(false),
m_waveformPeak(-1.0),
m_diffGain(0),
m_devicePixelRatio(1.0),
m_group(group),
m_pConfig(pConfig),
m_endOfTrack(false),
m_bPassthroughEnabled(false),
m_pCueMenuPopup(make_parented<WCueMenuPopup>(pConfig, this)),
m_bShowCueTimes(true),
m_iPosSeconds(0),
m_bLeftClickDragging(false),
m_iPickupPos(0),
m_iPlayPos(0),
m_pHoveredMark(nullptr),
m_bTimeRulerActive(false),
m_orientation(Qt::Horizontal),
m_iLabelFontSize(10),
m_a(1.0),
m_b(0.0),
m_analyzerProgress(kAnalyzerProgressUnknown),
m_trackLoaded(false),
m_scaleFactor(1.0) {
m_endOfTrackControl = new ControlProxy(
m_group, "end_of_track", this, ControlFlag::NoAssertIfMissing);
m_endOfTrackControl->connectValueChanged(this, &WOverview::onEndOfTrackChange);
m_pRateRatioControl = new ControlProxy(
m_group, "rate_ratio", this, ControlFlag::NoAssertIfMissing);
// Needed to recalculate range durations when rate slider is moved without the deck playing
m_pRateRatioControl->connectValueChanged(
this, &WOverview::onRateRatioChange);
m_trackSampleRateControl = new ControlProxy(
m_group, "track_samplerate", this, ControlFlag::NoAssertIfMissing);
m_trackSamplesControl = new ControlProxy(m_group, "track_samples", this);
m_playpositionControl = new ControlProxy(
m_group, "playposition", this, ControlFlag::NoAssertIfMissing);
m_pPassthroughControl =
new ControlProxy(m_group, "passthrough", this, ControlFlag::NoAssertIfMissing);
m_pPassthroughControl->connectValueChanged(this, &WOverview::onPassthroughChange);
onPassthroughChange(m_pPassthroughControl->get());
setAcceptDrops(true);
setMouseTracking(true);
connect(pPlayerManager, &PlayerManager::trackAnalyzerProgress,
this, &WOverview::onTrackAnalyzerProgress);
connect(m_pCueMenuPopup.get(), &WCueMenuPopup::aboutToHide, this, &WOverview::slotCueMenuPopupAboutToHide);
m_pPassthroughLabel = new QLabel(this);
m_pPassthroughLabel->setObjectName("PassthroughLabel");
m_pPassthroughLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
// Shown on the overview waveform when vinyl passthrough is enabled
m_pPassthroughLabel->setText(tr("Passthrough"));
m_pPassthroughLabel->hide();
QVBoxLayout *pPassthroughLayout = new QVBoxLayout(this);