#include "mixxxmainwindow.h"
#include <QDesktopServices>
#include <QFileDialog>
#include <QGLFormat>
#include <QUrl>
#include <QtDebug>
#include "defs_urls.h"
#include "dialog/dlgabout.h"
#include "dialog/dlgdevelopertools.h"
#include "dialog/dlgkeywheel.h"
#include "effects/effectsmanager.h"
#include "moc_mixxxmainwindow.cpp"
#include "preferences/constants.h"
#include "preferences/dialog/dlgpreferences.h"
#ifdef __LILV__
#include "effects/lv2/lv2backend.h"
#endif
#ifdef __BROADCAST__
#include "broadcast/broadcastmanager.h"
#endif
#include "control/controlindicatortimer.h"
#include "controllers/controllermanager.h"
#include "controllers/keyboard/keyboardeventfilter.h"
#include "database/mixxxdb.h"
#include "library/library.h"
#include "library/library_prefs.h"
#ifdef __ENGINEPRIME__
#include "library/export/libraryexporter.h"
#endif
#include "library/trackcollection.h"
#include "library/trackcollectionmanager.h"
#include "mixer/playerinfo.h"
#include "mixer/playermanager.h"
#include "preferences/settingsmanager.h"
#include "recording/recordingmanager.h"
#include "skin/legacy/launchimage.h"
#include "skin/skinloader.h"
#include "soundio/soundmanager.h"
#include "sources/soundsourceproxy.h"
#include "track/track.h"
#include "util/debug.h"
#include "util/experiment.h"
#include "util/font.h"
#include "util/logger.h"
#include "util/math.h"
#include "util/sandbox.h"
#include "util/screensaver.h"
#include "util/time.h"
#include "util/timer.h"
#include "util/translations.h"
#include "util/versionstore.h"
#include "util/widgethelper.h"
#include "waveform/guitick.h"
#include "waveform/sharedglcontext.h"
#include "waveform/visualsmanager.h"
#include "waveform/waveformwidgetfactory.h"
#include "widget/wmainmenubar.h"
#ifdef __VINYLCONTROL__
#include "vinylcontrol/vinylcontrolmanager.h"
#endif
#if defined(Q_OS_LINUX)
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
// Xlibint.h predates C++ and defines macros which conflict
// with references to std::max and std::min
#undef max
#undef min
#include <QtX11Extras/QX11Info>
#endif
MixxxMainWindow::MixxxMainWindow(std::shared_ptr<mixxx::CoreServices> pCoreServices)
: m_pCoreServices(pCoreServices),
m_pCentralWidget(nullptr),
m_pLaunchImage(nullptr),
m_pGuiTick(nullptr),
m_pDeveloperToolsDlg(nullptr),
m_pPrefDlg(nullptr),
m_toolTipsCfg(mixxx::TooltipsPreference::TOOLTIPS_ON) {
DEBUG_ASSERT(pCoreServices);
// These depend on the settings
createMenuBar();
m_pMenuBar->hide();
initializeWindow();
// Show launch image immediately so the user knows Mixxx is starting
m_pSkinLoader = std::make_unique<mixxx::skin::SkinLoader>(m_pCoreServices->getSettings());
m_pLaunchImage = m_pSkinLoader->loadLaunchImage(this);
m_pCentralWidget = (QWidget*)m_pLaunchImage;
setCentralWidget(m_pCentralWidget);
show();
m_pGuiTick = new GuiTick();
m_pVisualsManager = new VisualsManager();
}
void MixxxMainWindow::initialize() {
m_pCoreServices->getControlIndicatorTimer()->setLegacyVsyncEnabled(true);
UserSettingsPointer pConfig = m_pCoreServices->getSettings();
// Set the visibility of tooltips, default "1" = ON
m_toolTipsCfg = static_cast<mixxx::TooltipsPreference>(
pConfig->getValue(ConfigKey("[Controls]", "Tooltips"),
static_cast<int>(mixxx::TooltipsPreference::TOOLTIPS_ON)));
#ifdef __ENGINEPRIME__
// Initialise library exporter
// This has to be done before switching to fullscreen
m_pLibraryExporter = m_pCoreServices->getLibrary()->makeLibraryExporter(this);
connect(m_pCoreServices->getLibrary().get(),
&Library::exportLibrary,
m_pLibraryExporter.get(),
&mixxx::LibraryExporter::slotRequestExport);
connect(m_pCoreServices->getLibrary().get(),
&Library::exportCrate,
m_pLibraryExporter.get(),
&mixxx::LibraryExporter::slotRequestExportWithInitialCrate);
#endif
// Turn on fullscreen mode
// if we were told to start in fullscreen mode on the command-line
// or if the user chose to always start in fullscreen mode.
// Remember to refresh the Fullscreen menu item after connectMenuBar()
bool<