From 7f76595a68404db08fcf4435a99f01e46164f526 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Sat, 25 Mar 2017 20:28:48 +0100 Subject: [PATCH 01/14] Initial version of screensaver inhibitor. --- build/depends.py | 4 +- src/mixxx.cpp | 7 +- src/util/screensaver.cpp | 202 +++++++++++++++++++++++++++++++++++++++ src/util/screensaver.h | 32 +++++++ 4 files changed, 243 insertions(+), 2 deletions(-) create mode 100644 src/util/screensaver.cpp create mode 100644 src/util/screensaver.h diff --git a/build/depends.py b/build/depends.py index 4db71fe1c7b1..b156a17c8640 100644 --- a/build/depends.py +++ b/build/depends.py @@ -280,7 +280,8 @@ def configure(self, build, conf): raise Exception('Qt >= 5.0 not found') elif not qt5 and not conf.CheckForPKG('QtCore', '4.6'): raise Exception('QT >= 4.6 not found') - + + qt_modules.extend(['QtDBus']) # This automatically converts QtXXX to Qt5XXX where appropriate. if qt5: build.env.EnableQt5Modules(qt_modules, debug=False) @@ -1117,6 +1118,7 @@ def sources(self, build): "util/logging.cpp", "util/cmdlineargs.cpp", "util/audiosignal.cpp", + "util/screensaver.cpp", '#res/mixxx.qrc' ] diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 647226b0917f..7dc855e8e891 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -64,6 +64,7 @@ #include "skin/launchimage.h" #include "preferences/settingsmanager.h" #include "widget/wmainmenubar.h" +#include "util/screensaver.h" #ifdef __VINYLCONTROL__ #include "vinylcontrol/vinylcontrolmanager.h" @@ -434,6 +435,8 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { } } + mixxx::ScreenSaverHelper::inhibit(); + connect(&PlayerInfo::instance(), SIGNAL(currentPlayingTrackChanged(TrackPointer)), this, SLOT(slotUpdateWindowTitle(TrackPointer))); @@ -451,7 +454,9 @@ void MixxxMainWindow::finalize() { Timer t("MixxxMainWindow::~finalize"); t.start(); - // Save the current window state (position, maximized, etc) + mixxx::ScreenSaverHelper::uninhibit(); + + // Save the current window state (position, maximized, etc) m_pSettingsManager->settings()->set(ConfigKey("[MainWindow]", "geometry"), QString(saveGeometry().toBase64())); m_pSettingsManager->settings()->set(ConfigKey("[MainWindow]", "state"), diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp new file mode 100644 index 000000000000..d9feabda149e --- /dev/null +++ b/src/util/screensaver.cpp @@ -0,0 +1,202 @@ +#include + +/** +Documentation: +OSX: https://developer.apple.com/reference/iokit/1557134-iopmassertioncreatewithname +Windows: https://msdn.microsoft.com/en-us/library/windows/desktop/aa373208(v=vs.85).aspx +Freedesktop: https://people.freedesktop.org/~hadess/idle-inhibition-spec/re01.html +XScreenSaver: https://linux.die.net/man/3/xscreensaversuspend +GTK: https://developer.gnome.org/gtk3/stable/GtkApplication.html#gtk-application-inhibit + +With the help of the following source codes: + +https://github.com/videolan/vlc/blob/fbaa27ae2d7fcf5ccee7f0ca424ec0cc5bf01f4c/modules/gui/macosx/VLCInputManager.m#L299 +https://github.com/videolan/vlc/blob/fbaa27ae2d7fcf5ccee7f0ca424ec0cc5bf01f4c/modules/video_output/win32/events.c#L168 +https://github.com/GNOME/totem/blob/0c18deceed780e5ca13ba2b97446d81d70cfbec6/src/plugins/screensaver/totem-screensaver.c#L76 +https://github.com/awjackson/bsnes-classic/blob/038e2e051ffc8abe7c56a3bf27e3016c433ee563/bsnes/ui-qt/platform/platform_x.cpp + +**/ + +#include "util/screensaver.h" + +#if defined(Q_OS_MAC) +# include "util/mac.h" +#elif defined(Q_OS_WIN) +# include +#elif defined(Q_OS_LINUX) +# include +#elif HAVE_XSCREENSAVER_SUSPEND +# include +#endif // Q_OS_WIN + + +namespace mixxx { + +#ifdef Q_OS_MAC +IOPMAssertionID ScreenSaverHelper::systemSleepAssertionID=0; +IOPMAssertionID ScreenSaverHelper::userActivityAssertionID=0; + +void ScreenSaverHelper::inhibit() +{ + /* Declare user activity. + This wakes the display if it is off, and postpones display sleep according to the users system preferences + Available from 10.7.3 */ + if (&IOPMAssertionDeclareUserActivity) + { + CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, + _("Mixxx digital DJ software"), kCFStringEncodingUTF8); + IOReturn success = IOPMAssertionDeclareUserActivity(reasonForActivity, + kIOPMUserActiveLocal, + &userActivityAssertionID); + CFRelease(reasonForActivity); + + if (success != kIOReturnSuccess) { + qWarning("failed to declare user activity."); + } + } + + /* prevent the system from sleeping */ + if (systemSleepAssertionID > 0) { + qDebug("releasing old sleep blocker (%1)").arg(systemSleepAssertionID); + IOPMAssertionRelease(systemSleepAssertionID); + } + + IOReturn success; + /* work-around a bug in 10.7.4 and 10.7.5, so check for 10.7.x < 10.7.4 and 10.8 */ + if (NSAppKitVersionNumber < 1115.2) { + /* fall-back on the 10.5 mode, which also works on 10.7.4 and 10.7.5 */ + success = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, + &systemSleepAssertionID); + } else { + CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, + _("Mixxx digital DJ software"), kCFStringEncodingUTF8); + success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, + reasonForActivity, &systemSleepAssertionID); + CFRelease(reasonForActivity); + } + + if (success == kIOReturnSuccess) { + qDebug("prevented sleep through IOKit (%1)").arg(systemSleepAssertionID); + } else { + qWarning("failed to prevent system sleep through IOKit"); + } +} +void ScreenSaverHelper::uninhibit() +{ + /* allow the system to sleep again */ + if (systemSleepAssertionID > 0) { + qDebug("releasing sleep blocker (%1)").arg(systemSleepAssertionID); + IOPMAssertionRelease(systemSleepAssertionID); + } +} + +#elif defined(Q_OS_WIN) +void ScreenSaverHelper::inhibit() +{ + SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); +} +void ScreenSaverHelper::uninhibit() +{ + SetThreadExecutionState(ES_CONTINUOUS); +} + +#elif defined(Q_OS_LINUX) +const char *SCREENSAVERS[][4] = { + // org.freedesktop.ScreenSaver is the standard. should work for kde. + {"org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", "Inhibit"}, + {"org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "Inhibit"}, + // Seen this on internet, not sure if it was a typo or what. + {"org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager", "Inhibit"}, + // whatever... + {"org.kde.screensaver", "/ScreenSaver", "org.kde.screensaver", "SimulateUserActivity"}, + {nullptr, nullptr, nullptr, nullptr} +}; + +uint32_t ScreenSaverHelper::cookie = 0; +int ScreenSaverHelper::saverindex = -1; + +void ScreenSaverHelper::inhibit() +{ + if (!QDBusConnection::sessionBus().isConnected()) { + qWarning("Cannot connect to the D-Bus session bus.\nTo start it, run:\n" + "\teval `dbus-launch --auto-syntax`"); + return; + } + if (cookie > 0) { + uninhibit(); + } + cookie = 0; + for (int i=0; SCREENSAVERS[i][0] != nullptr; i++ ) { + QDBusInterface iface(SCREENSAVERS[i][0], SCREENSAVERS[i][1], SCREENSAVERS[i][2], + QDBusConnection::sessionBus()); + if (iface.isValid()) { + QDBusReply reply = iface.call("Inhibit", "org.mixxxdj","Mixxx active"); + if (reply.isValid()) { + cookie = reply.value(); + saverindex = i; + qDebug() << "DBus screensaver " << SCREENSAVERS[i][0] <<" inhibited"; + break; + } else { + qWarning() << "Call to inhibit for " << SCREENSAVERS[i][0] << " failed: " + << reply.error().message(); + return; + } + } else { + qDebug() << "DBus interface " << SCREENSAVERS[i][0] << " not valid"; + } + } +} +void ScreenSaverHelper::uninhibit() +{ + if (cookie > 0) { + QDBusInterface iface(SCREENSAVERS[saverindex][0], SCREENSAVERS[saverindex][1], + SCREENSAVERS[saverindex][2], QDBusConnection::sessionBus()); + if (iface.isValid()) { + QDBusReply reply = iface.call("UnInhibit", cookie); + if (reply.isValid()) { + cookie = 0; + qDebug() << "DBus screensaver " << SCREENSAVERS[saverindex][0] << " uninhibited"; + } else { + qWarning() << "Call to uninhibit for " << SCREENSAVERS[saverindex][0] << " failed: " + << reply.error().message(); + } + } else { + qDebug() << "DBus interface " << SCREENSAVERS[saverindex][0] << " not valid"; + } + } +} + +#elif HAS_XWINDOW_SCREENSAVER +void ScreenSaverHelper::inhibit() +{ + char *name = ":0.0"; + Display *display; + if (getenv("DISPLAY")) + name=getenv("DISPLAY"); + display=XOpenDisplay(name); + XScreenSaverSuspend(display,True); +} +void ScreenSaverHelper::uninhibit() +{ + char *name = ":0.0"; + Display *display; + if (getenv("DISPLAY")) + name=getenv("DISPLAY"); + display=XOpenDisplay(name); + XScreenSaverSuspend(, False); +} + +#else +void ScreenSaverHelper::inhibit() +{ + qError("Screensaver suspending not implemented"); +} +void ScreenSaverHelper::uninhibit() +{ + qError("Screensaver suspending not implemented"); +} +#endif // Q_OS_MAC + + +} // namespace mixxx + diff --git a/src/util/screensaver.h b/src/util/screensaver.h new file mode 100644 index 000000000000..5405c6f27b2d --- /dev/null +++ b/src/util/screensaver.h @@ -0,0 +1,32 @@ +#ifndef MIXXX_SCREENSAVER_H +#define MIXXX_SCREENSAVER_H + +#ifdef Q_OS_MAC +#import +#endif // Q_OS_MAC + +namespace mixxx { + +// Code related to interacting with the screensaver. +// +// Main use is to prevent the screensaver from starting if Mixxx is being used. +// +class ScreenSaverHelper { +public: + + static void inhibit(); + static void uninhibit(); + +#if defined(Q_OS_MAC) + /* sleep management */ + static IOPMAssertionID systemSleepAssertionID; + static IOPMAssertionID userActivityAssertionID; +#elif defined(Q_OS_LINUX) + static uint32_t cookie; + static int saverindex; +#endif // Q_OS_MAC +}; + +} + +#endif // MIXXX_SCREENSAVER_H From 0fb221a29d0257ce2a530597438d6bbc89080da6 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Sat, 25 Mar 2017 21:09:41 +0100 Subject: [PATCH 02/14] buildfix mac --- src/util/screensaver.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index d9feabda149e..f66edf114d9d 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -44,7 +44,7 @@ void ScreenSaverHelper::inhibit() if (&IOPMAssertionDeclareUserActivity) { CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, - _("Mixxx digital DJ software"), kCFStringEncodingUTF8); + "Mixxx digital DJ software", kCFStringEncodingUTF8); IOReturn success = IOPMAssertionDeclareUserActivity(reasonForActivity, kIOPMUserActiveLocal, &userActivityAssertionID); @@ -57,7 +57,7 @@ void ScreenSaverHelper::inhibit() /* prevent the system from sleeping */ if (systemSleepAssertionID > 0) { - qDebug("releasing old sleep blocker (%1)").arg(systemSleepAssertionID); + qDebug() "IOKit releasing old screensaver inhibitor" << systemSleepAssertionID; IOPMAssertionRelease(systemSleepAssertionID); } @@ -69,14 +69,14 @@ void ScreenSaverHelper::inhibit() &systemSleepAssertionID); } else { CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, - _("Mixxx digital DJ software"), kCFStringEncodingUTF8); + "Mixxx digital DJ software", kCFStringEncodingUTF8); success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &systemSleepAssertionID); CFRelease(reasonForActivity); } if (success == kIOReturnSuccess) { - qDebug("prevented sleep through IOKit (%1)").arg(systemSleepAssertionID); + qDebug() << "IOKit screensaver inhibited " << systemSleepAssertionID; } else { qWarning("failed to prevent system sleep through IOKit"); } @@ -85,8 +85,8 @@ void ScreenSaverHelper::uninhibit() { /* allow the system to sleep again */ if (systemSleepAssertionID > 0) { - qDebug("releasing sleep blocker (%1)").arg(systemSleepAssertionID); IOPMAssertionRelease(systemSleepAssertionID); + qDebug() << "IOKit screensaver uninhibited " << systemSleepAssertionID; } } @@ -94,10 +94,12 @@ void ScreenSaverHelper::uninhibit() void ScreenSaverHelper::inhibit() { SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); + qDebug() << "screensaver inhibited"; } void ScreenSaverHelper::uninhibit() { SetThreadExecutionState(ES_CONTINUOUS); + qDebug() << "screensaver uninhibited"; } #elif defined(Q_OS_LINUX) From 7d8a0e1698f1b0be9802eeebc4013b5f73b7b6a6 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Sat, 25 Mar 2017 21:11:52 +0100 Subject: [PATCH 03/14] buildfix mac --- src/util/screensaver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index f66edf114d9d..95efedde88c3 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -57,7 +57,7 @@ void ScreenSaverHelper::inhibit() /* prevent the system from sleeping */ if (systemSleepAssertionID > 0) { - qDebug() "IOKit releasing old screensaver inhibitor" << systemSleepAssertionID; + qDebug() << "IOKit releasing old screensaver inhibitor" << systemSleepAssertionID; IOPMAssertionRelease(systemSleepAssertionID); } From 1ec06ce54b96007251078b1ca6404731e0b3ed23 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Sat, 25 Mar 2017 22:24:23 +0100 Subject: [PATCH 04/14] buildfix mac --- src/util/screensaver.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index 95efedde88c3..b26b5cb38b05 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -62,12 +62,13 @@ void ScreenSaverHelper::inhibit() } IOReturn success; + // FIXME (JosepMaJAZ): I have no idea how to access the NSappKitVersionNumber. /* work-around a bug in 10.7.4 and 10.7.5, so check for 10.7.x < 10.7.4 and 10.8 */ - if (NSAppKitVersionNumber < 1115.2) { - /* fall-back on the 10.5 mode, which also works on 10.7.4 and 10.7.5 */ + /*if (NSAppKitVersionNumber < 1115.2) { + // fall-back on the 10.5 mode, which also works on 10.7.4 and 10.7.5 success = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &systemSleepAssertionID); - } else { + } else*/ { CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, "Mixxx digital DJ software", kCFStringEncodingUTF8); success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, From 67d36412f88dd69bf80a0dfaf2b688bdf5f83ae6 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Sun, 26 Mar 2017 14:09:25 +0200 Subject: [PATCH 05/14] Implemented user setting for enable/disable the inhibitor --- src/mixxx.cpp | 24 ++- src/preferences/constants.h | 7 + src/preferences/dialog/dlgprefcontrols.cpp | 46 ++++- src/preferences/dialog/dlgprefcontrolsdlg.ui | 204 ++++++++++--------- src/util/screensaver.cpp | 18 +- 5 files changed, 184 insertions(+), 115 deletions(-) diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 7dc855e8e891..8b67941db237 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -28,6 +28,7 @@ #include "dialog/dlgabout.h" #include "preferences/dialog/dlgpreferences.h" #include "preferences/dialog/dlgprefeq.h" +#include "preferences/constants.h" #include "dialog/dlgdevelopertools.h" #include "engine/enginemaster.h" #include "effects/effectsmanager.h" @@ -368,6 +369,18 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { } emit(newSkinLoaded()); + // Inhibit the screensaver if the option is set. + int inhibit = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver"),-1); + if (inhibit == -1) { + inhibit = static_cast(mixxx::ScreenSaverPreference::PREVENT_ON); + pConfig->setValue(ConfigKey("[Config]","InhibitScreensaver"), inhibit); + } + mixxx::ScreenSaverPreference inhiPref = mixxx::ScreenSaverPreference(inhibit); + if (inhiPref == mixxx::ScreenSaverPreference::PREVENT_ON) { + mixxx::ScreenSaverHelper::inhibit(); + } + + // Wait until all other ControlObjects are set up before initializing // controllers m_pControllerManager->setUpDevices(); @@ -434,9 +447,7 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { m_pPlayerManager->slotLoadToDeck(musicFiles.at(i), i+1); } } - - mixxx::ScreenSaverHelper::inhibit(); - + connect(&PlayerInfo::instance(), SIGNAL(currentPlayingTrackChanged(TrackPointer)), this, SLOT(slotUpdateWindowTitle(TrackPointer))); @@ -454,7 +465,12 @@ void MixxxMainWindow::finalize() { Timer t("MixxxMainWindow::~finalize"); t.start(); - mixxx::ScreenSaverHelper::uninhibit(); + int inhibit = m_pSettingsManager->settings()->getValue(ConfigKey("[Config]","InhibitScreensaver")); + mixxx::ScreenSaverPreference inhiPref = mixxx::ScreenSaverPreference(inhibit); + if (inhiPref == mixxx::ScreenSaverPreference::PREVENT_ON) { + mixxx::ScreenSaverHelper::uninhibit(); + } + // Save the current window state (position, maximized, etc) m_pSettingsManager->settings()->set(ConfigKey("[MainWindow]", "geometry"), diff --git a/src/preferences/constants.h b/src/preferences/constants.h index 137ca5782222..4bc73c32ec96 100644 --- a/src/preferences/constants.h +++ b/src/preferences/constants.h @@ -11,6 +11,13 @@ enum class TooltipsPreference { TOOLTIPS_ONLY_IN_LIBRARY = 2, }; +// Settings to enable or disable the prevention to run the screensaver. +enum class ScreenSaverPreference { + PREVENT_OFF = 0, + PREVENT_ON = 1, + PREVENT_ON_PLAY = 2 +}; + } // namespace mixxx #endif /* PREFERENCES_CONSTANTS_H */ diff --git a/src/preferences/dialog/dlgprefcontrols.cpp b/src/preferences/dialog/dlgprefcontrols.cpp index c92237b98cb6..755411dcddbb 100644 --- a/src/preferences/dialog/dlgprefcontrols.cpp +++ b/src/preferences/dialog/dlgprefcontrols.cpp @@ -37,6 +37,7 @@ #include "mixer/playermanager.h" #include "control/controlobject.h" #include "mixxx.h" +#include "util/screensaver.h" #include "defs_urls.h" DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx, @@ -305,6 +306,21 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx, ConfigKey("[Config]", "StartInFullscreen")).toInt()==1); connect(checkBoxStartFullScreen, SIGNAL(toggled(bool)), this, SLOT(slotSetStartInFullScreen(bool))); + + // + // Screensaver mode + // + comboBoxScreensaver->clear(); + comboBoxScreensaver->addItem(tr("Allow screensaver to run"), + static_cast(mixxx::ScreenSaverPreference::PREVENT_OFF)); + comboBoxScreensaver->addItem(tr("Prevent screensaver from runnig"), + static_cast(mixxx::ScreenSaverPreference::PREVENT_ON)); + comboBoxScreensaver->addItem(tr("Prevent screensaver while playing"), + static_cast(mixxx::ScreenSaverPreference::PREVENT_ON_PLAY)); + + int inhibitsettings = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver")); + comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData(inhibitsettings)); + // // Tooltip configuration // @@ -456,6 +472,10 @@ void DlgPrefControls::slotResetToDefaults() { // Don't start in full screen. checkBoxStartFullScreen->setChecked(false); + // Inhibit the screensaver + comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData( + static_cast(mixxx::ScreenSaverPreference::PREVENT_ON))); + // Tooltips on everywhere. radioButtonTooltipsLibraryAndSkin->setChecked(true); @@ -493,7 +513,6 @@ void DlgPrefControls::slotSetRateRange(int pos) { slotSetRateRangePercent(ComboBoxRateRange->itemData(pos).toInt()); } - void DlgPrefControls::slotSetRateRangePercent (int rateRangePercent) { double rateRange = rateRangePercent / 100.; @@ -681,6 +700,31 @@ void DlgPrefControls::slotApply() { int configSPAutoReset = BaseTrackPlayer::RESET_NONE; + // screensaver mode update + int inhibitcombo = comboBoxScreensaver->itemData( + comboBoxScreensaver->currentIndex()).toInt(); + int inhibitsettings = m_pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver")); + if (inhibitcombo != inhibitsettings) { + m_pConfig->set(ConfigKey("[Config]", "InhibitScreensaver"), ConfigValue(inhibitcombo)); + + mixxx::ScreenSaverPreference inhiOld = mixxx::ScreenSaverPreference(inhibitsettings); + if (inhiOld == mixxx::ScreenSaverPreference::PREVENT_ON) { + mixxx::ScreenSaverHelper::uninhibit(); + } else if (inhiOld == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY && + 1 /*TODO(JosepMaJAZ) Playing detector*/) { + mixxx::ScreenSaverHelper::uninhibit(); + } + + mixxx::ScreenSaverPreference inhiNew = mixxx::ScreenSaverPreference(inhibitcombo); + if (inhiNew == mixxx::ScreenSaverPreference::PREVENT_ON) { + mixxx::ScreenSaverHelper::inhibit(); + } else if (inhiNew == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY && + 0 /*TODO(JosepMaJAZ) Playing detector*/) { + mixxx::ScreenSaverHelper::inhibit(); + } + } + + if (m_speedAutoReset && m_pitchAutoReset) { configSPAutoReset = BaseTrackPlayer::RESET_PITCH_AND_SPEED; } diff --git a/src/preferences/dialog/dlgprefcontrolsdlg.ui b/src/preferences/dialog/dlgprefcontrolsdlg.ui index 460769c922dd..ed31b5758cc2 100644 --- a/src/preferences/dialog/dlgprefcontrolsdlg.ui +++ b/src/preferences/dialog/dlgprefcontrolsdlg.ui @@ -7,7 +7,7 @@ 0 0 485 - 554 + 574 @@ -420,27 +420,14 @@ - - - - - 0 - 0 - - - - - - - - - + + - Locale - - - ComboBoxLocale + Remaining + + buttonGroupTrackTime + @@ -462,17 +449,20 @@ - - - - Remaining + + + + + 0 + 0 + + + + - - buttonGroupTrackTime - - + Elapsed @@ -482,6 +472,26 @@ + + + + Locale + + + ComboBoxLocale + + + + + + + + + + Qt::AlignJustify|Qt::AlignVCenter + + + @@ -489,7 +499,14 @@ - + + + + Qt::Horizontal + + + + true @@ -518,20 +535,26 @@ - - - - + + + + + 0 + 0 + - - Qt::AlignJustify|Qt::AlignVCenter + + + + + Select from different color schemes of a skin if available. - - - - Qt::Horizontal + + + + Do not load tracks into playing decks @@ -554,30 +577,7 @@ - - - - Locales determine country and language specific settings. - - - - - - - - 0 - 0 - - - - - - - Select from different color schemes of a skin if available. - - - - + Playing track protection @@ -587,27 +587,24 @@ - - - - Do not load tracks into playing decks + + + + Locales determine country and language specific settings. - - + + - Cue mode - - - true + Auto cue - ComboBoxCueDefault + checkBoxSeekToCue - + Mixxx mode: @@ -632,7 +629,20 @@ CUP mode: - + + + + Cue mode + + + true + + + ComboBoxCueDefault + + + + Automatically seeks to the first saved cue point on track load. @@ -643,13 +653,22 @@ CUP mode: - - + + + + true + + + + - Auto cue + Tool tips + + + false - checkBoxSeekToCue + radioButtonTooltipsOff @@ -687,25 +706,16 @@ CUP mode: - - - - true - - - - + + - Tool tips - - - false - - - radioButtonTooltipsOff + Screen saver + + + @@ -884,6 +894,8 @@ CUP mode: + + @@ -891,7 +903,5 @@ CUP mode: false - - diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index b26b5cb38b05..e3880d0cfd78 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -62,19 +62,11 @@ void ScreenSaverHelper::inhibit() } IOReturn success; - // FIXME (JosepMaJAZ): I have no idea how to access the NSappKitVersionNumber. - /* work-around a bug in 10.7.4 and 10.7.5, so check for 10.7.x < 10.7.4 and 10.8 */ - /*if (NSAppKitVersionNumber < 1115.2) { - // fall-back on the 10.5 mode, which also works on 10.7.4 and 10.7.5 - success = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, - &systemSleepAssertionID); - } else*/ { - CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, - "Mixxx digital DJ software", kCFStringEncodingUTF8); - success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, - reasonForActivity, &systemSleepAssertionID); - CFRelease(reasonForActivity); - } + CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, + "Mixxx digital DJ software", kCFStringEncodingUTF8); + success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, + reasonForActivity, &systemSleepAssertionID); + CFRelease(reasonForActivity); if (success == kIOReturnSuccess) { qDebug() << "IOKit screensaver inhibited " << systemSleepAssertionID; From 4b52ac0f6865e7405aafaa9781f0a69184e262e4 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Sun, 26 Mar 2017 18:49:27 +0200 Subject: [PATCH 06/14] Implemented inhibit on play --- src/mixer/playerinfo.h | 2 +- src/mixxx.cpp | 16 ++++++++++++++- src/mixxx.h | 1 + src/preferences/dialog/dlgprefcontrols.cpp | 14 ++++++------- src/util/screensaver.cpp | 23 +++++++++++++++++++++- src/util/screensaver.h | 3 +++ 6 files changed, 49 insertions(+), 10 deletions(-) diff --git a/src/mixer/playerinfo.h b/src/mixer/playerinfo.h index a16537ba179c..78e566e636a3 100644 --- a/src/mixer/playerinfo.h +++ b/src/mixer/playerinfo.h @@ -33,6 +33,7 @@ class PlayerInfo : public QObject { TrackPointer getTrackInfo(const QString& group); void setTrackInfo(const QString& group, const TrackPointer& trackInfoObj); TrackPointer getCurrentPlayingTrack(); + int getCurrentPlayingDeck(); QMap getLoadedTracks(); bool isTrackLoaded(const TrackPointer& pTrack) const; bool isFileLoaded(const QString& track_location) const; @@ -62,7 +63,6 @@ class PlayerInfo : public QObject { void clearControlCache(); void timerEvent(QTimerEvent* pTimerEvent); void updateCurrentPlayingDeck(); - int getCurrentPlayingDeck(); DeckControls* getDeckControls(int i); PlayerInfo(); diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 8b67941db237..c11aac01b44e 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -452,6 +452,10 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { SIGNAL(currentPlayingTrackChanged(TrackPointer)), this, SLOT(slotUpdateWindowTitle(TrackPointer))); + connect(&PlayerInfo::instance(), + SIGNAL(currentPlayingDeckChanged(int)), + this, SLOT(slotChangedPlayingDeck(int))); + // this has to be after the OpenGL widgets are created or depending on a // million different variables the first waveform may be horribly // corrupted. See bug 521509 -- bkgood ?? -- vrince @@ -465,7 +469,8 @@ void MixxxMainWindow::finalize() { Timer t("MixxxMainWindow::~finalize"); t.start(); - int inhibit = m_pSettingsManager->settings()->getValue(ConfigKey("[Config]","InhibitScreensaver")); + UserSettingsPointer pConfig = m_pSettingsManager->settings(); + int inhibit = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver")); mixxx::ScreenSaverPreference inhiPref = mixxx::ScreenSaverPreference(inhibit); if (inhiPref == mixxx::ScreenSaverPreference::PREVENT_ON) { mixxx::ScreenSaverHelper::uninhibit(); @@ -1100,6 +1105,15 @@ void MixxxMainWindow::slotNoMicrophoneInputConfigured() { m_pPrefDlg->showSoundHardwarePage(); } +void MixxxMainWindow::slotChangedPlayingDeck(int deck) { + UserSettingsPointer pConfig = m_pSettingsManager->settings(); + int inhibit = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver")); + mixxx::ScreenSaverPreference inhiPref = mixxx::ScreenSaverPreference(inhibit); + if (inhiPref == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) { + mixxx::ScreenSaverHelper::inhibitOnCondition(deck!=-1); + } +} + void MixxxMainWindow::slotHelpAbout() { DlgAbout* about = new DlgAbout(this); about->show(); diff --git a/src/mixxx.h b/src/mixxx.h index da793a501190..b3ee9c2e2ef7 100644 --- a/src/mixxx.h +++ b/src/mixxx.h @@ -88,6 +88,7 @@ class MixxxMainWindow : public QMainWindow { void slotDeveloperToolsClosed(); void slotUpdateWindowTitle(TrackPointer pTrack); + void slotChangedPlayingDeck(int deck); // Warn the user when inputs are not configured. void slotNoMicrophoneInputConfigured(); diff --git a/src/preferences/dialog/dlgprefcontrols.cpp b/src/preferences/dialog/dlgprefcontrols.cpp index 755411dcddbb..bb3cfe7a71f5 100644 --- a/src/preferences/dialog/dlgprefcontrols.cpp +++ b/src/preferences/dialog/dlgprefcontrols.cpp @@ -35,6 +35,7 @@ #include "skin/skinloader.h" #include "skin/legacyskinparser.h" #include "mixer/playermanager.h" +#include "mixer/playerinfo.h" #include "control/controlobject.h" #include "mixxx.h" #include "util/screensaver.h" @@ -313,7 +314,7 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx, comboBoxScreensaver->clear(); comboBoxScreensaver->addItem(tr("Allow screensaver to run"), static_cast(mixxx::ScreenSaverPreference::PREVENT_OFF)); - comboBoxScreensaver->addItem(tr("Prevent screensaver from runnig"), + comboBoxScreensaver->addItem(tr("Prevent screensaver from running"), static_cast(mixxx::ScreenSaverPreference::PREVENT_ON)); comboBoxScreensaver->addItem(tr("Prevent screensaver while playing"), static_cast(mixxx::ScreenSaverPreference::PREVENT_ON_PLAY)); @@ -710,17 +711,16 @@ void DlgPrefControls::slotApply() { mixxx::ScreenSaverPreference inhiOld = mixxx::ScreenSaverPreference(inhibitsettings); if (inhiOld == mixxx::ScreenSaverPreference::PREVENT_ON) { mixxx::ScreenSaverHelper::uninhibit(); - } else if (inhiOld == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY && - 1 /*TODO(JosepMaJAZ) Playing detector*/) { - mixxx::ScreenSaverHelper::uninhibit(); + } else if (inhiOld == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) { + mixxx::ScreenSaverHelper::inhibitOnCondition(false); } mixxx::ScreenSaverPreference inhiNew = mixxx::ScreenSaverPreference(inhibitcombo); if (inhiNew == mixxx::ScreenSaverPreference::PREVENT_ON) { mixxx::ScreenSaverHelper::inhibit(); - } else if (inhiNew == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY && - 0 /*TODO(JosepMaJAZ) Playing detector*/) { - mixxx::ScreenSaverHelper::inhibit(); + } else if (inhiNew == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) { + mixxx::ScreenSaverHelper::inhibitOnCondition( + PlayerInfo::instance().getCurrentPlayingDeck()!=-1); } } diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index e3880d0cfd78..a8756f57b6e2 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -32,6 +32,17 @@ With the help of the following source codes: namespace mixxx { +bool ScreenSaverHelper::enabled = false; + +void ScreenSaverHelper::inhibitOnCondition(bool desired) +{ + if (desired != enabled) { + if (enabled) uninhibit(); + else inhibit(); + } +} + + #ifdef Q_OS_MAC IOPMAssertionID ScreenSaverHelper::systemSleepAssertionID=0; IOPMAssertionID ScreenSaverHelper::userActivityAssertionID=0; @@ -69,6 +80,7 @@ void ScreenSaverHelper::inhibit() CFRelease(reasonForActivity); if (success == kIOReturnSuccess) { + enabled = true; qDebug() << "IOKit screensaver inhibited " << systemSleepAssertionID; } else { qWarning("failed to prevent system sleep through IOKit"); @@ -78,6 +90,7 @@ void ScreenSaverHelper::uninhibit() { /* allow the system to sleep again */ if (systemSleepAssertionID > 0) { + enabled = false; IOPMAssertionRelease(systemSleepAssertionID); qDebug() << "IOKit screensaver uninhibited " << systemSleepAssertionID; } @@ -86,13 +99,17 @@ void ScreenSaverHelper::uninhibit() #elif defined(Q_OS_WIN) void ScreenSaverHelper::inhibit() { + // Calling once without "ES_CONTINUOUS" to force the monitor to wake up. + SetThreadExecutionState( ES_DISPLAY_REQUIRED ); SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); qDebug() << "screensaver inhibited"; + enabled = true; } void ScreenSaverHelper::uninhibit() { SetThreadExecutionState(ES_CONTINUOUS); qDebug() << "screensaver uninhibited"; + enabled = false; } #elif defined(Q_OS_LINUX) @@ -129,6 +146,7 @@ void ScreenSaverHelper::inhibit() if (reply.isValid()) { cookie = reply.value(); saverindex = i; + enabled = true; qDebug() << "DBus screensaver " << SCREENSAVERS[i][0] <<" inhibited"; break; } else { @@ -144,6 +162,7 @@ void ScreenSaverHelper::inhibit() void ScreenSaverHelper::uninhibit() { if (cookie > 0) { + enabled = false; QDBusInterface iface(SCREENSAVERS[saverindex][0], SCREENSAVERS[saverindex][1], SCREENSAVERS[saverindex][2], QDBusConnection::sessionBus()); if (iface.isValid()) { @@ -170,6 +189,7 @@ void ScreenSaverHelper::inhibit() name=getenv("DISPLAY"); display=XOpenDisplay(name); XScreenSaverSuspend(display,True); + enabled = true; } void ScreenSaverHelper::uninhibit() { @@ -178,7 +198,8 @@ void ScreenSaverHelper::uninhibit() if (getenv("DISPLAY")) name=getenv("DISPLAY"); display=XOpenDisplay(name); - XScreenSaverSuspend(, False); + XScreenSaverSuspend(display, False); + enabled = false; } #else diff --git a/src/util/screensaver.h b/src/util/screensaver.h index 5405c6f27b2d..72331f2db66e 100644 --- a/src/util/screensaver.h +++ b/src/util/screensaver.h @@ -16,7 +16,10 @@ class ScreenSaverHelper { static void inhibit(); static void uninhibit(); + static void inhibitOnCondition(bool desired); +private: + static bool enabled; #if defined(Q_OS_MAC) /* sleep management */ static IOPMAssertionID systemSleepAssertionID; From 21ce197c4ed3b51f8ed138a5c0ab3ccce91fb1aa Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Tue, 28 Mar 2017 22:40:29 +0200 Subject: [PATCH 07/14] moved settings and logic to MixxMainWindow. Changed logic on ScreenSaverHelper to remove inhibitOnCondition --- src/mixxx.cpp | 46 ++++++--- src/mixxx.h | 3 + src/preferences/dialog/dlgprefcontrols.cpp | 21 +--- src/util/screensaver.cpp | 106 +++++++++++---------- src/util/screensaver.h | 14 +-- 5 files changed, 106 insertions(+), 84 deletions(-) diff --git a/src/mixxx.cpp b/src/mixxx.cpp index c11aac01b44e..46e4d669c051 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -375,8 +375,8 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { inhibit = static_cast(mixxx::ScreenSaverPreference::PREVENT_ON); pConfig->setValue(ConfigKey("[Config]","InhibitScreensaver"), inhibit); } - mixxx::ScreenSaverPreference inhiPref = mixxx::ScreenSaverPreference(inhibit); - if (inhiPref == mixxx::ScreenSaverPreference::PREVENT_ON) { + m_inhibitScreensaver = static_cast(inhibit); + if (m_inhibitScreensaver == mixxx::ScreenSaverPreference::PREVENT_ON) { mixxx::ScreenSaverHelper::inhibit(); } @@ -469,10 +469,7 @@ void MixxxMainWindow::finalize() { Timer t("MixxxMainWindow::~finalize"); t.start(); - UserSettingsPointer pConfig = m_pSettingsManager->settings(); - int inhibit = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver")); - mixxx::ScreenSaverPreference inhiPref = mixxx::ScreenSaverPreference(inhibit); - if (inhiPref == mixxx::ScreenSaverPreference::PREVENT_ON) { + if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) { mixxx::ScreenSaverHelper::uninhibit(); } @@ -1106,11 +1103,13 @@ void MixxxMainWindow::slotNoMicrophoneInputConfigured() { } void MixxxMainWindow::slotChangedPlayingDeck(int deck) { - UserSettingsPointer pConfig = m_pSettingsManager->settings(); - int inhibit = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver")); - mixxx::ScreenSaverPreference inhiPref = mixxx::ScreenSaverPreference(inhibit); - if (inhiPref == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) { - mixxx::ScreenSaverHelper::inhibitOnCondition(deck!=-1); + if (m_inhibitScreensaver == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) { + if (deck==-1) { + // If no deck is playing, allow the screensaver to run. + mixxx::ScreenSaverHelper::uninhibit(); + } else { + mixxx::ScreenSaverHelper::inhibit(); + } } } @@ -1318,6 +1317,31 @@ bool MixxxMainWindow::confirmExit() { return true; } +void MixxxMainWindow::setInhibitScreensaver(mixxx::ScreenSaverPreference newInhibit) +{ + UserSettingsPointer pConfig = m_pSettingsManager->settings(); + + if (m_inhibitScreensaver != mixxx::ScreenSaverPreference::PREVENT_OFF) { + mixxx::ScreenSaverHelper::uninhibit(); + } + + if (newInhibit == mixxx::ScreenSaverPreference::PREVENT_ON) { + mixxx::ScreenSaverHelper::inhibit(); + } else if (newInhibit == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY + && PlayerInfo::instance().getCurrentPlayingDeck()!=-1) { + mixxx::ScreenSaverHelper::inhibit(); + } + + int inhibit_int = static_cast(newInhibit); + pConfig->set(ConfigKey("[Config]", "InhibitScreensaver"), ConfigValue(inhibit_int)); + m_inhibitScreensaver = newInhibit; +} + +mixxx::ScreenSaverPreference MixxxMainWindow::getInhibitScreensaver() +{ + return m_inhibitScreensaver; +} + void MixxxMainWindow::launchProgress(int progress) { if (m_pLaunchImage) { m_pLaunchImage->progress(progress); diff --git a/src/mixxx.h b/src/mixxx.h index b3ee9c2e2ef7..c8e2fd43ec4f 100644 --- a/src/mixxx.h +++ b/src/mixxx.h @@ -65,6 +65,8 @@ class MixxxMainWindow : public QMainWindow { // creates the menu_bar and inserts the file Menu void createMenuBar(); void connectMenuBar(); + void setInhibitScreensaver(mixxx::ScreenSaverPreference inhibit); + mixxx::ScreenSaverPreference getInhibitScreensaver(); void setToolTipsCfg(mixxx::TooltipsPreference tt); inline mixxx::TooltipsPreference getToolTipsCfg() { return m_toolTipsCfg; } @@ -176,6 +178,7 @@ class MixxxMainWindow : public QMainWindow { const CmdlineArgs& m_cmdLineArgs; ControlPushButton* m_pTouchShift; + mixxx::ScreenSaverPreference m_inhibitScreensaver; static const int kMicrophoneCount; static const int kAuxiliaryCount; diff --git a/src/preferences/dialog/dlgprefcontrols.cpp b/src/preferences/dialog/dlgprefcontrols.cpp index bb3cfe7a71f5..38072938ac79 100644 --- a/src/preferences/dialog/dlgprefcontrols.cpp +++ b/src/preferences/dialog/dlgprefcontrols.cpp @@ -319,7 +319,7 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx, comboBoxScreensaver->addItem(tr("Prevent screensaver while playing"), static_cast(mixxx::ScreenSaverPreference::PREVENT_ON_PLAY)); - int inhibitsettings = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver")); + int inhibitsettings = static_cast(mixxx->getInhibitScreensaver()); comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData(inhibitsettings)); // @@ -704,24 +704,9 @@ void DlgPrefControls::slotApply() { // screensaver mode update int inhibitcombo = comboBoxScreensaver->itemData( comboBoxScreensaver->currentIndex()).toInt(); - int inhibitsettings = m_pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver")); + int inhibitsettings = static_cast(m_mixxx->getInhibitScreensaver()); if (inhibitcombo != inhibitsettings) { - m_pConfig->set(ConfigKey("[Config]", "InhibitScreensaver"), ConfigValue(inhibitcombo)); - - mixxx::ScreenSaverPreference inhiOld = mixxx::ScreenSaverPreference(inhibitsettings); - if (inhiOld == mixxx::ScreenSaverPreference::PREVENT_ON) { - mixxx::ScreenSaverHelper::uninhibit(); - } else if (inhiOld == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) { - mixxx::ScreenSaverHelper::inhibitOnCondition(false); - } - - mixxx::ScreenSaverPreference inhiNew = mixxx::ScreenSaverPreference(inhibitcombo); - if (inhiNew == mixxx::ScreenSaverPreference::PREVENT_ON) { - mixxx::ScreenSaverHelper::inhibit(); - } else if (inhiNew == mixxx::ScreenSaverPreference::PREVENT_ON_PLAY) { - mixxx::ScreenSaverHelper::inhibitOnCondition( - PlayerInfo::instance().getCurrentPlayingDeck()!=-1); - } + m_mixxx->setInhibitScreensaver(static_cast(inhibitcombo)); } diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index a8756f57b6e2..f735a48a4aa3 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -32,22 +32,29 @@ With the help of the following source codes: namespace mixxx { -bool ScreenSaverHelper::enabled = false; +bool ScreenSaverHelper::s_enabled = false; -void ScreenSaverHelper::inhibitOnCondition(bool desired) +// inhibitInternal and unihibitInternal should be called the same amount of times +// depending on the implementation used. This ensures it. +void ScreenSaverHelper::inhibit() +{ + if (!s_enabled) { + inhibit(); + } +} +void ScreenSaverHelper::uninhibit() { - if (desired != enabled) { - if (enabled) uninhibit(); - else inhibit(); + if (s_enabled) { + uninhibit(); } } #ifdef Q_OS_MAC -IOPMAssertionID ScreenSaverHelper::systemSleepAssertionID=0; -IOPMAssertionID ScreenSaverHelper::userActivityAssertionID=0; +IOPMAssertionID ScreenSaverHelper::s_systemSleepAssertionID=0; +IOPMAssertionID ScreenSaverHelper::s_userActivityAssertionID=0; -void ScreenSaverHelper::inhibit() +void ScreenSaverHelper::inhibitInternal() { /* Declare user activity. This wakes the display if it is off, and postpones display sleep according to the users system preferences @@ -58,7 +65,7 @@ void ScreenSaverHelper::inhibit() "Mixxx digital DJ software", kCFStringEncodingUTF8); IOReturn success = IOPMAssertionDeclareUserActivity(reasonForActivity, kIOPMUserActiveLocal, - &userActivityAssertionID); + &s_userActivityAssertionID); CFRelease(reasonForActivity); if (success != kIOReturnSuccess) { @@ -67,49 +74,49 @@ void ScreenSaverHelper::inhibit() } /* prevent the system from sleeping */ - if (systemSleepAssertionID > 0) { - qDebug() << "IOKit releasing old screensaver inhibitor" << systemSleepAssertionID; - IOPMAssertionRelease(systemSleepAssertionID); + if (s_systemSleepAssertionID > 0) { + qDebug() << "IOKit releasing old screensaver inhibitor" << s_systemSleepAssertionID; + IOPMAssertionRelease(s_systemSleepAssertionID); } IOReturn success; CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, "Mixxx digital DJ software", kCFStringEncodingUTF8); success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, - reasonForActivity, &systemSleepAssertionID); + reasonForActivity, &s_systemSleepAssertionID); CFRelease(reasonForActivity); if (success == kIOReturnSuccess) { - enabled = true; - qDebug() << "IOKit screensaver inhibited " << systemSleepAssertionID; + s_enabled = true; + qDebug() << "IOKit screensaver inhibited " << s_systemSleepAssertionID; } else { qWarning("failed to prevent system sleep through IOKit"); } } -void ScreenSaverHelper::uninhibit() +void ScreenSaverHelper::uninhibitInternal() { /* allow the system to sleep again */ - if (systemSleepAssertionID > 0) { - enabled = false; - IOPMAssertionRelease(systemSleepAssertionID); - qDebug() << "IOKit screensaver uninhibited " << systemSleepAssertionID; + if (s_systemSleepAssertionID > 0) { + s_enabled = false; + qDebug() << "IOKit screensaver uninhibited " << s_systemSleepAssertionID; + IOPMAssertionRelease(s_systemSleepAssertionID); } } #elif defined(Q_OS_WIN) -void ScreenSaverHelper::inhibit() +void ScreenSaverHelper::inhibitInternal() { // Calling once without "ES_CONTINUOUS" to force the monitor to wake up. SetThreadExecutionState( ES_DISPLAY_REQUIRED ); SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); qDebug() << "screensaver inhibited"; - enabled = true; + s_enabled = true; } -void ScreenSaverHelper::uninhibit() +void ScreenSaverHelper::uninhibitInternal() { SetThreadExecutionState(ES_CONTINUOUS); qDebug() << "screensaver uninhibited"; - enabled = false; + s_enabled = false; } #elif defined(Q_OS_LINUX) @@ -119,34 +126,34 @@ const char *SCREENSAVERS[][4] = { {"org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "Inhibit"}, // Seen this on internet, not sure if it was a typo or what. {"org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager", "Inhibit"}, - // whatever... + // This can be used to simulate action instead. gnome also has "SimulateUserActivity". {"org.kde.screensaver", "/ScreenSaver", "org.kde.screensaver", "SimulateUserActivity"}, {nullptr, nullptr, nullptr, nullptr} }; -uint32_t ScreenSaverHelper::cookie = 0; -int ScreenSaverHelper::saverindex = -1; +uint32_t ScreenSaverHelper::s_cookie = 0; +int ScreenSaverHelper::s_saverindex = -1; -void ScreenSaverHelper::inhibit() +void ScreenSaverHelper::inhibitInternal() { if (!QDBusConnection::sessionBus().isConnected()) { qWarning("Cannot connect to the D-Bus session bus.\nTo start it, run:\n" "\teval `dbus-launch --auto-syntax`"); return; } - if (cookie > 0) { + if (s_cookie > 0) { uninhibit(); } - cookie = 0; + s_cookie = 0; for (int i=0; SCREENSAVERS[i][0] != nullptr; i++ ) { QDBusInterface iface(SCREENSAVERS[i][0], SCREENSAVERS[i][1], SCREENSAVERS[i][2], QDBusConnection::sessionBus()); if (iface.isValid()) { QDBusReply reply = iface.call("Inhibit", "org.mixxxdj","Mixxx active"); if (reply.isValid()) { - cookie = reply.value(); - saverindex = i; - enabled = true; + s_cookie = reply.value(); + s_saverindex = i; + s_enabled = true; qDebug() << "DBus screensaver " << SCREENSAVERS[i][0] <<" inhibited"; break; } else { @@ -159,29 +166,30 @@ void ScreenSaverHelper::inhibit() } } } -void ScreenSaverHelper::uninhibit() +void ScreenSaverHelper::uninhibitInternal() { - if (cookie > 0) { - enabled = false; - QDBusInterface iface(SCREENSAVERS[saverindex][0], SCREENSAVERS[saverindex][1], - SCREENSAVERS[saverindex][2], QDBusConnection::sessionBus()); + if (s_cookie > 0) { + s_enabled = false; + QDBusInterface iface(SCREENSAVERS[s_saverindex][0], SCREENSAVERS[s_saverindex][1], + SCREENSAVERS[s_saverindex][2], QDBusConnection::sessionBus()); if (iface.isValid()) { - QDBusReply reply = iface.call("UnInhibit", cookie); + QDBusReply reply = iface.call("UnInhibit", s_cookie); if (reply.isValid()) { - cookie = 0; - qDebug() << "DBus screensaver " << SCREENSAVERS[saverindex][0] << " uninhibited"; + s_cookie = 0; + qDebug() << "DBus screensaver " << SCREENSAVERS[s_saverindex][0] << " uninhibited"; } else { - qWarning() << "Call to uninhibit for " << SCREENSAVERS[saverindex][0] << " failed: " + qWarning() << "Call to uninhibit for " << SCREENSAVERS[s_saverindex][0] << " failed: " << reply.error().message(); } } else { - qDebug() << "DBus interface " << SCREENSAVERS[saverindex][0] << " not valid"; + qDebug() << "DBus interface " << SCREENSAVERS[s_saverindex][0] << " not valid"; } } } #elif HAS_XWINDOW_SCREENSAVER -void ScreenSaverHelper::inhibit() +// This is untested. +void ScreenSaverHelper::inhibitInternal() { char *name = ":0.0"; Display *display; @@ -189,9 +197,9 @@ void ScreenSaverHelper::inhibit() name=getenv("DISPLAY"); display=XOpenDisplay(name); XScreenSaverSuspend(display,True); - enabled = true; + s_enabled = true; } -void ScreenSaverHelper::uninhibit() +void ScreenSaverHelper::uninhibitInternal() { char *name = ":0.0"; Display *display; @@ -199,15 +207,15 @@ void ScreenSaverHelper::uninhibit() name=getenv("DISPLAY"); display=XOpenDisplay(name); XScreenSaverSuspend(display, False); - enabled = false; + s_enabled = false; } #else -void ScreenSaverHelper::inhibit() +void ScreenSaverHelper::inhibitInternal() { qError("Screensaver suspending not implemented"); } -void ScreenSaverHelper::uninhibit() +void ScreenSaverHelper::uninhibitInternal() { qError("Screensaver suspending not implemented"); } diff --git a/src/util/screensaver.h b/src/util/screensaver.h index 72331f2db66e..a2a8f3eac6f2 100644 --- a/src/util/screensaver.h +++ b/src/util/screensaver.h @@ -16,17 +16,19 @@ class ScreenSaverHelper { static void inhibit(); static void uninhibit(); - static void inhibitOnCondition(bool desired); private: - static bool enabled; + static void inhibitInternal(); + static void uninhibitInternal(); + + static bool s_enabled; #if defined(Q_OS_MAC) /* sleep management */ - static IOPMAssertionID systemSleepAssertionID; - static IOPMAssertionID userActivityAssertionID; + static IOPMAssertionID s_systemSleepAssertionID; + static IOPMAssertionID s_userActivityAssertionID; #elif defined(Q_OS_LINUX) - static uint32_t cookie; - static int saverindex; + static uint32_t s_cookie; + static int s_saverindex; #endif // Q_OS_MAC }; From 1ae1af910ebef84caf92fb4f974d2256269e1eaa Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Tue, 28 Mar 2017 23:40:55 +0200 Subject: [PATCH 08/14] added code to trigger user activity to the ScreenSaverHelper class. --- src/util/screensaver.cpp | 92 ++++++++++++++++++++++++++++++++++++---- src/util/screensaver.h | 2 + 2 files changed, 86 insertions(+), 8 deletions(-) diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index f735a48a4aa3..eea22cd117de 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -26,6 +26,11 @@ With the help of the following source codes: #elif defined(Q_OS_LINUX) # include #elif HAVE_XSCREENSAVER_SUSPEND +# define None XNone +# define Window XWindow +# include +# undef None +# undef Window # include #endif // Q_OS_WIN @@ -54,7 +59,7 @@ void ScreenSaverHelper::uninhibit() IOPMAssertionID ScreenSaverHelper::s_systemSleepAssertionID=0; IOPMAssertionID ScreenSaverHelper::s_userActivityAssertionID=0; -void ScreenSaverHelper::inhibitInternal() +void ScreenSaverHelper::triggerUserActivity() { /* Declare user activity. This wakes the display if it is off, and postpones display sleep according to the users system preferences @@ -72,7 +77,12 @@ void ScreenSaverHelper::inhibitInternal() qWarning("failed to declare user activity."); } } +} +void ScreenSaverHelper::inhibitInternal() +{ + triggerUserActivity(); + /* prevent the system from sleeping */ if (s_systemSleepAssertionID > 0) { qDebug() << "IOKit releasing old screensaver inhibitor" << s_systemSleepAssertionID; @@ -101,13 +111,20 @@ void ScreenSaverHelper::uninhibitInternal() qDebug() << "IOKit screensaver uninhibited " << s_systemSleepAssertionID; IOPMAssertionRelease(s_systemSleepAssertionID); } + if (s_userActivityAssertionID > 0) { + IOPMAssertionRelease(s_userActivityAssertionID); + } } #elif defined(Q_OS_WIN) +void ScreenSaverHelper::triggerUserActivity() +{ + SetThreadExecutionState( ES_DISPLAY_REQUIRED ); +} void ScreenSaverHelper::inhibitInternal() { // Calling once without "ES_CONTINUOUS" to force the monitor to wake up. - SetThreadExecutionState( ES_DISPLAY_REQUIRED ); + triggerUserActivity(); SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); qDebug() << "screensaver inhibited"; s_enabled = true; @@ -121,19 +138,58 @@ void ScreenSaverHelper::uninhibitInternal() #elif defined(Q_OS_LINUX) const char *SCREENSAVERS[][4] = { - // org.freedesktop.ScreenSaver is the standard. should work for kde. + // org.freedesktop.ScreenSaver is the standard. should work for gnome and kde too, + // but I add their specific names too {"org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", "Inhibit"}, {"org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "Inhibit"}, - // Seen this on internet, not sure if it was a typo or what. - {"org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager", "Inhibit"}, - // This can be used to simulate action instead. gnome also has "SimulateUserActivity". + {"org.kde.screensaver", "/ScreenSaver", "org.kde.screensaver", "Inhibit"}, + {nullptr, nullptr, nullptr, nullptr} +}; +const char *USERACTIVITY[][4] = { + // org.freedesktop.ScreenSaver is the standard. should work for gnome and kde too, + // but I add their specific names too + {"org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity"}, + {"org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity"}, {"org.kde.screensaver", "/ScreenSaver", "org.kde.screensaver", "SimulateUserActivity"}, {nullptr, nullptr, nullptr, nullptr} }; uint32_t ScreenSaverHelper::s_cookie = 0; int ScreenSaverHelper::s_saverindex = -1; +bool ScreenSaverHelper::s_sendActivity = true; +void ScreenSaverHelper::triggerUserActivity() +{ + if (!s_sendActivity) { + return; + } + + s_sendActivity = false; + if (!QDBusConnection::sessionBus().isConnected()) { + qWarning("Cannot connect to the D-Bus session bus.\nTo start it, run:\n" + "\teval `dbus-launch --auto-syntax`"); + return; + } + s_sendActivity = false; + for (int i=0; USERACTIVITY[i][0] != nullptr; i++ ) { + QDBusInterface iface(USERACTIVITY[i][0], USERACTIVITY[i][1], USERACTIVITY[i][2], + QDBusConnection::sessionBus()); + if (iface.isValid()) { + QDBusReply reply = iface.call(USERACTIVITY[i][3]); + if (reply.isValid()) { + s_sendActivity = true; + break; + } else { + qWarning() << "Call to inhibit for " << USERACTIVITY[i][0] << " failed: " + << reply.error().message(); + } + } + } + if (!s_sendActivity) { + qWarning() << "Could not send activity using the registered DBus methods. " + << "Will not try again until the program is restarted. "; + } +} void ScreenSaverHelper::inhibitInternal() { if (!QDBusConnection::sessionBus().isConnected()) { @@ -149,7 +205,7 @@ void ScreenSaverHelper::inhibitInternal() QDBusInterface iface(SCREENSAVERS[i][0], SCREENSAVERS[i][1], SCREENSAVERS[i][2], QDBusConnection::sessionBus()); if (iface.isValid()) { - QDBusReply reply = iface.call("Inhibit", "org.mixxxdj","Mixxx active"); + QDBusReply reply = iface.call(SCREENSAVERS[i][3], "org.mixxxdj","Mixxx active"); if (reply.isValid()) { s_cookie = reply.value(); s_saverindex = i; @@ -159,7 +215,6 @@ void ScreenSaverHelper::inhibitInternal() } else { qWarning() << "Call to inhibit for " << SCREENSAVERS[i][0] << " failed: " << reply.error().message(); - return; } } else { qDebug() << "DBus interface " << SCREENSAVERS[i][0] << " not valid"; @@ -189,6 +244,27 @@ void ScreenSaverHelper::uninhibitInternal() #elif HAS_XWINDOW_SCREENSAVER // This is untested. +struct LibXtst : public library { + function XTestFakeKeyEvent; + + LibXtst() { + if(open("Xtst")) { + XTestFakeKeyEvent = sym("XTestFakeKeyEvent"); + } + } +} libXtst; + +void ScreenSaverHelper::triggerUserActivity() +{ + char *name = ":0.0"; + Display *display; + if (getenv("DISPLAY")) + name=getenv("DISPLAY"); + display=XOpenDisplay(name); + libXtst.XTestFakeKeyEvent(display, 255, True, 0); + libXtst.XTestFakeKeyEvent(display, 255, False, 0); + XCloseDisplay(display); +} void ScreenSaverHelper::inhibitInternal() { char *name = ":0.0"; diff --git a/src/util/screensaver.h b/src/util/screensaver.h index a2a8f3eac6f2..4a5633fd8d46 100644 --- a/src/util/screensaver.h +++ b/src/util/screensaver.h @@ -16,12 +16,14 @@ class ScreenSaverHelper { static void inhibit(); static void uninhibit(); + static void triggerUserActivity(); private: static void inhibitInternal(); static void uninhibitInternal(); static bool s_enabled; + static bool s_sendActivity; #if defined(Q_OS_MAC) /* sleep management */ static IOPMAssertionID s_systemSleepAssertionID; From e091467b68232d762df14ce97abe96175374fd30 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Wed, 29 Mar 2017 00:11:27 +0200 Subject: [PATCH 09/14] UserActivity triggering from controllers. Independently of screensaver setting. Also fixed bug due to the new inhibitInternal methods --- src/controllers/controller.cpp | 11 +++++++++++ src/controllers/controller.h | 1 + src/controllers/midi/midicontroller.cpp | 20 ++++++++++++++++++++ src/controllers/midi/midicontroller.h | 1 + src/util/screensaver.cpp | 6 ++++-- 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/controllers/controller.cpp b/src/controllers/controller.cpp index 92086b393b73..085084903ef2 100644 --- a/src/controllers/controller.cpp +++ b/src/controllers/controller.cpp @@ -11,6 +11,7 @@ #include "controllers/controller.h" #include "controllers/controllerdebug.h" #include "controllers/defs_controllers.h" +#include "util/screensaver.h" Controller::Controller() : QObject(), @@ -96,6 +97,16 @@ void Controller::send(QList data, unsigned int length) { } void Controller::receive(const QByteArray data, mixxx::Duration timestamp) { + if (userActivityInhibitTimer.isNull()) { + mixxx::ScreenSaverHelper::triggerUserActivity(); + userActivityInhibitTimer.start(); + } + // Inhibit Updates for 1000 milliseconds + if (userActivityInhibitTimer.elapsed() > 1000) { + mixxx::ScreenSaverHelper::triggerUserActivity(); + userActivityInhibitTimer.start(); + } + if (m_pEngine == NULL) { //qWarning() << "Controller::receive called with no active engine!"; // Don't complain, since this will always show after closing a device as diff --git a/src/controllers/controller.h b/src/controllers/controller.h index 185a2801feb6..57c94cab2ed9 100644 --- a/src/controllers/controller.h +++ b/src/controllers/controller.h @@ -157,6 +157,7 @@ class Controller : public QObject, ConstControllerPresetVisitor { // Indicates whether or not the device has been opened for input/output. bool m_bIsOpen; bool m_bLearning; + QTime userActivityInhibitTimer; // accesses lots of our stuff, but in the same thread friend class ControllerManager; diff --git a/src/controllers/midi/midicontroller.cpp b/src/controllers/midi/midicontroller.cpp index 731c4e6ea79c..945fe2d845ab 100644 --- a/src/controllers/midi/midicontroller.cpp +++ b/src/controllers/midi/midicontroller.cpp @@ -15,6 +15,7 @@ #include "errordialoghandler.h" #include "mixer/playermanager.h" #include "util/math.h" +#include "util/screensaver.h" MidiController::MidiController() : Controller() { @@ -199,6 +200,16 @@ void MidiController::commitTemporaryInputMappings() { void MidiController::receive(unsigned char status, unsigned char control, unsigned char value, mixxx::Duration timestamp) { + if (userActivityInhibitTimer.isNull()) { + mixxx::ScreenSaverHelper::triggerUserActivity(); + userActivityInhibitTimer.start(); + } + // Inhibit Updates for 1000 milliseconds + if (userActivityInhibitTimer.elapsed() > 1000) { + mixxx::ScreenSaverHelper::triggerUserActivity(); + userActivityInhibitTimer.start(); + } + unsigned char channel = MidiUtils::channelFromStatus(status); unsigned char opCode = MidiUtils::opCodeFromStatus(status); @@ -452,6 +463,15 @@ double MidiController::computeValue(MidiOptions options, double _prevmidivalue, void MidiController::receive(QByteArray data, mixxx::Duration timestamp) { controllerDebug(MidiUtils::formatSysexMessage(getName(), data, timestamp)); + if (userActivityInhibitTimer.isNull()) { + mixxx::ScreenSaverHelper::triggerUserActivity(); + userActivityInhibitTimer.start(); + } + // Inhibit Updates for 1000 milliseconds + if (userActivityInhibitTimer.elapsed() > 1000) { + mixxx::ScreenSaverHelper::triggerUserActivity(); + userActivityInhibitTimer.start(); + } MidiKey mappingKey(data.at(0), 0xFF); diff --git a/src/controllers/midi/midicontroller.h b/src/controllers/midi/midicontroller.h index 93d91fdf4436..80a15933cb8a 100644 --- a/src/controllers/midi/midicontroller.h +++ b/src/controllers/midi/midicontroller.h @@ -108,6 +108,7 @@ class MidiController : public Controller { MidiControllerPreset m_preset; SoftTakeoverCtrl m_st; QList > m_fourteen_bit_queued_mappings; + QTime userActivityInhibitTimer; // So it can access sendShortMsg() friend class MidiOutputHandler; diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index eea22cd117de..6cf923366780 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -44,13 +44,13 @@ bool ScreenSaverHelper::s_enabled = false; void ScreenSaverHelper::inhibit() { if (!s_enabled) { - inhibit(); + inhibitInternal(); } } void ScreenSaverHelper::uninhibit() { if (s_enabled) { - uninhibit(); + uninhibitInternal(); } } @@ -111,6 +111,8 @@ void ScreenSaverHelper::uninhibitInternal() qDebug() << "IOKit screensaver uninhibited " << s_systemSleepAssertionID; IOPMAssertionRelease(s_systemSleepAssertionID); } + // JosepMaJAZ: I am not sure if this needs to be called or not, and specifically when + // called on on the triggerUserActivity alone. if (s_userActivityAssertionID > 0) { IOPMAssertionRelease(s_userActivityAssertionID); } From aa97512bf3711eb3187bd404fd771df5658beee3 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Wed, 29 Mar 2017 22:26:39 +0200 Subject: [PATCH 10/14] several fixes and code reorganization --- src/controllers/controller.cpp | 17 +++++++++-------- src/controllers/controller.h | 5 ++++- src/controllers/midi/midicontroller.cpp | 21 ++------------------- src/controllers/midi/midicontroller.h | 1 - src/mixer/playerinfo.cpp | 3 +-- src/mixxx.cpp | 3 +-- src/util/screensaver.cpp | 8 ++++++-- 7 files changed, 23 insertions(+), 35 deletions(-) diff --git a/src/controllers/controller.cpp b/src/controllers/controller.cpp index 085084903ef2..e30ff7a5f63a 100644 --- a/src/controllers/controller.cpp +++ b/src/controllers/controller.cpp @@ -20,6 +20,7 @@ Controller::Controller() m_bIsInputDevice(false), m_bIsOpen(false), m_bLearning(false) { + m_userActivityInhibitTimer.start(); } Controller::~Controller() { @@ -96,16 +97,15 @@ void Controller::send(QList data, unsigned int length) { send(msg); } -void Controller::receive(const QByteArray data, mixxx::Duration timestamp) { - if (userActivityInhibitTimer.isNull()) { - mixxx::ScreenSaverHelper::triggerUserActivity(); - userActivityInhibitTimer.start(); - } +void Controller::triggerActivity() +{ // Inhibit Updates for 1000 milliseconds - if (userActivityInhibitTimer.elapsed() > 1000) { + if (m_userActivityInhibitTimer.elapsed() > 1000) { mixxx::ScreenSaverHelper::triggerUserActivity(); - userActivityInhibitTimer.start(); - } + m_userActivityInhibitTimer.start(); + } +} +void Controller::receive(const QByteArray data, mixxx::Duration timestamp) { if (m_pEngine == NULL) { //qWarning() << "Controller::receive called with no active engine!"; @@ -113,6 +113,7 @@ void Controller::receive(const QByteArray data, mixxx::Duration timestamp) { // queued signals flush out return; } + triggerActivity(); int length = data.size(); if (ControllerDebug::enabled()) { diff --git a/src/controllers/controller.h b/src/controllers/controller.h index 57c94cab2ed9..9cc6be386ce2 100644 --- a/src/controllers/controller.h +++ b/src/controllers/controller.h @@ -101,6 +101,9 @@ class Controller : public QObject, ConstControllerPresetVisitor { // To be called in sub-class' close() functions after stopping any input // polling/processing but before closing the device. void stopEngine(); + + // To be called when receiving events + void triggerActivity(); inline ControllerEngine* getEngine() const { return m_pEngine; @@ -157,7 +160,7 @@ class Controller : public QObject, ConstControllerPresetVisitor { // Indicates whether or not the device has been opened for input/output. bool m_bIsOpen; bool m_bLearning; - QTime userActivityInhibitTimer; + QTime m_userActivityInhibitTimer; // accesses lots of our stuff, but in the same thread friend class ControllerManager; diff --git a/src/controllers/midi/midicontroller.cpp b/src/controllers/midi/midicontroller.cpp index 945fe2d845ab..c2848d302023 100644 --- a/src/controllers/midi/midicontroller.cpp +++ b/src/controllers/midi/midicontroller.cpp @@ -200,16 +200,6 @@ void MidiController::commitTemporaryInputMappings() { void MidiController::receive(unsigned char status, unsigned char control, unsigned char value, mixxx::Duration timestamp) { - if (userActivityInhibitTimer.isNull()) { - mixxx::ScreenSaverHelper::triggerUserActivity(); - userActivityInhibitTimer.start(); - } - // Inhibit Updates for 1000 milliseconds - if (userActivityInhibitTimer.elapsed() > 1000) { - mixxx::ScreenSaverHelper::triggerUserActivity(); - userActivityInhibitTimer.start(); - } - unsigned char channel = MidiUtils::channelFromStatus(status); unsigned char opCode = MidiUtils::opCodeFromStatus(status); @@ -217,6 +207,7 @@ void MidiController::receive(unsigned char status, unsigned char control, channel, opCode, timestamp)); MidiKey mappingKey(status, control); + triggerActivity(); if (isLearning()) { emit(messageReceived(status, control, value)); @@ -463,18 +454,10 @@ double MidiController::computeValue(MidiOptions options, double _prevmidivalue, void MidiController::receive(QByteArray data, mixxx::Duration timestamp) { controllerDebug(MidiUtils::formatSysexMessage(getName(), data, timestamp)); - if (userActivityInhibitTimer.isNull()) { - mixxx::ScreenSaverHelper::triggerUserActivity(); - userActivityInhibitTimer.start(); - } - // Inhibit Updates for 1000 milliseconds - if (userActivityInhibitTimer.elapsed() > 1000) { - mixxx::ScreenSaverHelper::triggerUserActivity(); - userActivityInhibitTimer.start(); - } MidiKey mappingKey(data.at(0), 0xFF); + triggerActivity(); // TODO(rryan): Need to review how MIDI learn works with sysex messages. I // don't think this actually does anything useful. if (isLearning()) { diff --git a/src/controllers/midi/midicontroller.h b/src/controllers/midi/midicontroller.h index 80a15933cb8a..93d91fdf4436 100644 --- a/src/controllers/midi/midicontroller.h +++ b/src/controllers/midi/midicontroller.h @@ -108,7 +108,6 @@ class MidiController : public Controller { MidiControllerPreset m_preset; SoftTakeoverCtrl m_st; QList > m_fourteen_bit_queued_mappings; - QTime userActivityInhibitTimer; // So it can access sendShortMsg() friend class MidiOutputHandler; diff --git a/src/mixer/playerinfo.cpp b/src/mixer/playerinfo.cpp index a668be273404..dd38804712b0 100644 --- a/src/mixer/playerinfo.cpp +++ b/src/mixer/playerinfo.cpp @@ -119,7 +119,7 @@ void PlayerInfo::updateCurrentPlayingDeck() { continue; } - if (pDc->m_pregain.get() <= 0.5) { + if (pDc->m_pregain.get() <= 0.25) { continue; } @@ -150,7 +150,6 @@ void PlayerInfo::updateCurrentPlayingDeck() { maxVolume = dvol; } } - if (maxDeck != m_currentlyPlayingDeck) { m_currentlyPlayingDeck = maxDeck; locker.unlock(); diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 6caadb97cfd6..33dd68fc2210 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -1333,9 +1333,8 @@ void MixxxMainWindow::setInhibitScreensaver(mixxx::ScreenSaverPreference newInhi && PlayerInfo::instance().getCurrentPlayingDeck()!=-1) { mixxx::ScreenSaverHelper::inhibit(); } - int inhibit_int = static_cast(newInhibit); - pConfig->set(ConfigKey("[Config]", "InhibitScreensaver"), ConfigValue(inhibit_int)); + pConfig->setValue(ConfigKey("[Config]","InhibitScreensaver"), inhibit_int); m_inhibitScreensaver = newInhibit; } diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index 6cf923366780..719ae9fbfaab 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -289,13 +289,17 @@ void ScreenSaverHelper::uninhibitInternal() } #else +void ScreenSaverHelper::triggerUserActivity() +{ + DEBUG_ASSERT(!"Screensaver trigger activity not implemented"); +} void ScreenSaverHelper::inhibitInternal() { - qError("Screensaver suspending not implemented"); + DEBUG_ASSERT(!"Screensaver suspending not implemented") } void ScreenSaverHelper::uninhibitInternal() { - qError("Screensaver suspending not implemented"); + DEBUG_ASSERT(!"Screensaver suspending not implemented"); } #endif // Q_OS_MAC From 411e6f8c895f127ddfe92be5db934fd6566fb5e3 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Fri, 31 Mar 2017 20:35:35 +0200 Subject: [PATCH 11/14] that merge went really bad... --- build/depends.py | 1521 +++++++++--------- src/preferences/dialog/dlgprefcontrolsdlg.ui | 1018 ++++++------ 2 files changed, 1274 insertions(+), 1265 deletions(-) diff --git a/build/depends.py b/build/depends.py index 54e31243e01f..80155c76273b 100644 --- a/build/depends.py +++ b/build/depends.py @@ -307,822 +307,821 @@ def configure(self, build, conf): if not framework_path: raise Exception( 'Could not find frameworks in Qt directory: %s' % qtdir) - # Necessary for raw includes of headers like #include - build.env.Append(CPPPATH=[os.path.join(framework_path, '%s.framework' % m, 'Headers') - for m in qt_modules]) - # Framework path needs to be altered for CCFLAGS as well since a - # header include of QtCore/QObject.h looks for a QtCore.framework on - # the search path and a QObject.h in QtCore.framework/Headers. - build.env.Append(CCFLAGS=['-F%s' % os.path.join(framework_path)]) - build.env.Append(LINKFLAGS=['-F%s' % os.path.join(framework_path)]) - - # Copied verbatim from qt4.py and qt5.py. - # TODO(rryan): Get our fixes merged upstream so we can use qt4.py - # and qt5.py for OS X. - qt4_module_defines = { - 'QtScript' : ['QT_SCRIPT_LIB'], - 'QtSvg' : ['QT_SVG_LIB'], - 'Qt3Support' : ['QT_QT3SUPPORT_LIB','QT3_SUPPORT'], - 'QtSql' : ['QT_SQL_LIB'], - 'QtXml' : ['QT_XML_LIB'], - 'QtOpenGL' : ['QT_OPENGL_LIB'], - 'QtGui' : ['QT_GUI_LIB'], - 'QtNetwork' : ['QT_NETWORK_LIB'], - 'QtCore' : ['QT_CORE_LIB'], - } - qt5_module_defines = { - 'QtScript' : ['QT_SCRIPT_LIB'], - 'QtSvg' : ['QT_SVG_LIB'], - 'QtSql' : ['QT_SQL_LIB'], - 'QtXml' : ['QT_XML_LIB'], - 'QtOpenGL' : ['QT_OPENGL_LIB'], - 'QtGui' : ['QT_GUI_LIB'], - 'QtNetwork' : ['QT_NETWORK_LIB'], - 'QtCore' : ['QT_CORE_LIB'], - 'QtWidgets' : ['QT_WIDGETS_LIB'], - } + # Necessary for raw includes of headers like #include + build.env.Append(CPPPATH=[os.path.join(framework_path, '%s.framework' % m, 'Headers') + for m in qt_modules]) + # Framework path needs to be altered for CCFLAGS as well since a + # header include of QtCore/QObject.h looks for a QtCore.framework on + # the search path and a QObject.h in QtCore.framework/Headers. + build.env.Append(CCFLAGS=['-F%s' % os.path.join(framework_path)]) + build.env.Append(LINKFLAGS=['-F%s' % os.path.join(framework_path)]) + + # Copied verbatim from qt4.py and qt5.py. + # TODO(rryan): Get our fixes merged upstream so we can use qt4.py + # and qt5.py for OS X. + qt4_module_defines = { + 'QtScript' : ['QT_SCRIPT_LIB'], + 'QtSvg' : ['QT_SVG_LIB'], + 'Qt3Support' : ['QT_QT3SUPPORT_LIB','QT3_SUPPORT'], + 'QtSql' : ['QT_SQL_LIB'], + 'QtXml' : ['QT_XML_LIB'], + 'QtOpenGL' : ['QT_OPENGL_LIB'], + 'QtGui' : ['QT_GUI_LIB'], + 'QtNetwork' : ['QT_NETWORK_LIB'], + 'QtCore' : ['QT_CORE_LIB'], + } + qt5_module_defines = { + 'QtScript' : ['QT_SCRIPT_LIB'], + 'QtSvg' : ['QT_SVG_LIB'], + 'QtSql' : ['QT_SQL_LIB'], + 'QtXml' : ['QT_XML_LIB'], + 'QtOpenGL' : ['QT_OPENGL_LIB'], + 'QtGui' : ['QT_GUI_LIB'], + 'QtNetwork' : ['QT_NETWORK_LIB'], + 'QtCore' : ['QT_CORE_LIB'], + 'QtWidgets' : ['QT_WIDGETS_LIB'], + } + + module_defines = qt5_module_defines if qt5 else qt4_module_defines + for module in qt_modules: + build.env.AppendUnique(CPPDEFINES=module_defines.get(module, [])) - module_defines = qt5_module_defines if qt5 else qt4_module_defines - for module in qt_modules: - build.env.AppendUnique(CPPDEFINES=module_defines.get(module, [])) - - if qt5: - build.env["QT5_MOCCPPPATH"] = build.env["CPPPATH"] - else: - build.env["QT4_MOCCPPPATH"] = build.env["CPPPATH"] - elif build.platform_is_windows: - # This automatically converts QtCore to QtCore[45][d] where - # appropriate. - if qt5: - build.env.EnableQt5Modules(qt_modules, - staticdeps=build.static_qt, - debug=build.build_is_debug) - else: - build.env.EnableQt4Modules(qt_modules, - staticdeps=build.static_qt, - debug=build.build_is_debug) + if qt5: + build.env["QT5_MOCCPPPATH"] = build.env["CPPPATH"] + else: + build.env["QT4_MOCCPPPATH"] = build.env["CPPPATH"] + elif build.platform_is_windows: + # This automatically converts QtCore to QtCore[45][d] where + # appropriate. + if qt5: + build.env.EnableQt5Modules(qt_modules, + staticdeps=build.static_qt, + debug=build.build_is_debug) + else: + build.env.EnableQt4Modules(qt_modules, + staticdeps=build.static_qt, + debug=build.build_is_debug) + + if build.static_qt: + # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf + # QtCore + build.env.Append(LIBS = 'kernel32') + build.env.Append(LIBS = 'user32') # QtGui, QtOpenGL, libHSS1394 + build.env.Append(LIBS = 'shell32') + build.env.Append(LIBS = 'uuid') + build.env.Append(LIBS = 'ole32') # QtGui, + build.env.Append(LIBS = 'advapi32') # QtGui, portaudio, portmidi + build.env.Append(LIBS = 'ws2_32') # QtGui, QtNetwork, libshout + # QtGui + build.env.Append(LIBS = 'gdi32') #QtOpenGL, libshout + build.env.Append(LIBS = 'comdlg32') + build.env.Append(LIBS = 'oleaut32') + build.env.Append(LIBS = 'imm32') + build.env.Append(LIBS = 'winmm') + build.env.Append(LIBS = 'winspool') + # QtOpenGL + build.env.Append(LIBS = 'glu32') + build.env.Append(LIBS = 'opengl32') + + # QtNetwork openssl-linked + build.env.Append(LIBS = 'crypt32') + + # NOTE(rryan): If you are adding a plugin here, you must also + # update src/mixxxapplication.cpp to define a Q_IMPORT_PLUGIN + # for it. Not all imageformats plugins are built as .libs when + # building Qt statically on Windows. Check the build environment + # to see exactly what's available as a standalone .lib vs linked + # into Qt .libs by default. + + # iconengines plugins + build.env.Append(LIBPATH=[ + os.path.join(build.env['QTDIR'],'plugins/iconengines')]) + build.env.Append(LIBS = 'qsvgicon') + + # imageformats plugins + build.env.Append(LIBPATH=[ + os.path.join(build.env['QTDIR'],'plugins/imageformats')]) + build.env.Append(LIBS = 'qico') + build.env.Append(LIBS = 'qsvg') + build.env.Append(LIBS = 'qtga') + + # accessibility plugins + build.env.Append(LIBPATH=[ + os.path.join(build.env['QTDIR'],'plugins/accessible')]) + build.env.Append(LIBS = 'qtaccessiblewidgets') + + + # Set the rpath for linux/bsd/osx. + # This is not supported on OS X before the 10.5 SDK. + using_104_sdk = (str(build.env["CCFLAGS"]).find("10.4") >= 0) + compiling_on_104 = False + if build.platform_is_osx: + compiling_on_104 = ( + os.popen('sw_vers').readlines()[1].find('10.4') >= 0) + if not build.platform_is_windows and not (using_104_sdk or compiling_on_104): + qtdir = build.env['QTDIR'] + framework_path = Qt.find_framework_libdir(qtdir, qt5) + if os.path.isdir(framework_path): + build.env.Append(LINKFLAGS="-Wl,-rpath," + framework_path) + build.env.Append(LINKFLAGS="-L" + framework_path) - if build.static_qt: - # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf - # QtCore - build.env.Append(LIBS = 'kernel32') - build.env.Append(LIBS = 'user32') # QtGui, QtOpenGL, libHSS1394 - build.env.Append(LIBS = 'shell32') - build.env.Append(LIBS = 'uuid') - build.env.Append(LIBS = 'ole32') # QtGui, - build.env.Append(LIBS = 'advapi32') # QtGui, portaudio, portmidi - build.env.Append(LIBS = 'ws2_32') # QtGui, QtNetwork, libshout - # QtGui - build.env.Append(LIBS = 'gdi32') #QtOpenGL, libshout - build.env.Append(LIBS = 'comdlg32') - build.env.Append(LIBS = 'oleaut32') - build.env.Append(LIBS = 'imm32') - build.env.Append(LIBS = 'winmm') - build.env.Append(LIBS = 'winspool') - # QtOpenGL - build.env.Append(LIBS = 'glu32') - build.env.Append(LIBS = 'opengl32') - - # QtNetwork openssl-linked - build.env.Append(LIBS = 'crypt32') - - # NOTE(rryan): If you are adding a plugin here, you must also - # update src/mixxxapplication.cpp to define a Q_IMPORT_PLUGIN - # for it. Not all imageformats plugins are built as .libs when - # building Qt statically on Windows. Check the build environment - # to see exactly what's available as a standalone .lib vs linked - # into Qt .libs by default. - - # iconengines plugins - build.env.Append(LIBPATH=[ - os.path.join(build.env['QTDIR'],'plugins/iconengines')]) - build.env.Append(LIBS = 'qsvgicon') - - # imageformats plugins - build.env.Append(LIBPATH=[ - os.path.join(build.env['QTDIR'],'plugins/imageformats')]) - build.env.Append(LIBS = 'qico') - build.env.Append(LIBS = 'qsvg') - build.env.Append(LIBS = 'qtga') - - # accessibility plugins - build.env.Append(LIBPATH=[ - os.path.join(build.env['QTDIR'],'plugins/accessible')]) - build.env.Append(LIBS = 'qtaccessiblewidgets') - - - # Set the rpath for linux/bsd/osx. - # This is not supported on OS X before the 10.5 SDK. - using_104_sdk = (str(build.env["CCFLAGS"]).find("10.4") >= 0) - compiling_on_104 = False - if build.platform_is_osx: - compiling_on_104 = ( - os.popen('sw_vers').readlines()[1].find('10.4') >= 0) - if not build.platform_is_windows and not (using_104_sdk or compiling_on_104): - qtdir = build.env['QTDIR'] - framework_path = Qt.find_framework_libdir(qtdir, qt5) - if os.path.isdir(framework_path): - build.env.Append(LINKFLAGS="-Wl,-rpath," + framework_path) - build.env.Append(LINKFLAGS="-L" + framework_path) - - # Mixxx requires C++11 support. Windows enables C++11 features by - # default but Clang/GCC require a flag. - if not build.platform_is_windows: - build.env.Append(CXXFLAGS='-std=c++11') + # Mixxx requires C++11 support. Windows enables C++11 features by + # default but Clang/GCC require a flag. + if not build.platform_is_windows: + build.env.Append(CXXFLAGS='-std=c++11') class TestHeaders(Dependence): -def configure(self, build, conf): - build.env.Append(CPPPATH="#lib/gtest-1.7.0/include") + def configure(self, build, conf): + build.env.Append(CPPPATH="#lib/gtest-1.7.0/include") class FidLib(Dependence): - -def sources(self, build): - symbol = None - if build.platform_is_windows: - if build.toolchain_is_msvs: - symbol = 'T_MSVC' - elif build.crosscompile: - # Not sure why, but fidlib won't build with mingw32msvc and - # T_MINGW + def sources(self, build): + symbol = None + if build.platform_is_windows: + if build.toolchain_is_msvs: + symbol = 'T_MSVC' + elif build.crosscompile: + # Not sure why, but fidlib won't build with mingw32msvc and + # T_MINGW + symbol = 'T_LINUX' + elif build.toolchain_is_gnu: + symbol = 'T_MINGW' + else: symbol = 'T_LINUX' - elif build.toolchain_is_gnu: - symbol = 'T_MINGW' - else: - symbol = 'T_LINUX' - return [build.env.StaticObject('#lib/fidlib-0.9.10/fidlib.c', - CPPDEFINES=symbol)] + return [build.env.StaticObject('#lib/fidlib-0.9.10/fidlib.c', + CPPDEFINES=symbol)] -def configure(self, build, conf): - build.env.Append(CPPPATH='#lib/fidlib-0.9.10/') + def configure(self, build, conf): + build.env.Append(CPPPATH='#lib/fidlib-0.9.10/') class ReplayGain(Dependence): -def sources(self, build): - return ["#lib/replaygain/replaygain.cpp"] + def sources(self, build): + return ["#lib/replaygain/replaygain.cpp"] -def configure(self, build, conf): - build.env.Append(CPPPATH="#lib/replaygain") + def configure(self, build, conf): + build.env.Append(CPPPATH="#lib/replaygain") class Ebur128Mit(Dependence): -INTERNAL_PATH = '#lib/libebur128-1.1.0' -INTERNAL_LINK = False + INTERNAL_PATH = '#lib/libebur128-1.1.0' + INTERNAL_LINK = False -def sources(self, build): - if self.INTERNAL_LINK: - return ['%s/ebur128/ebur128.c' % self.INTERNAL_PATH] + def sources(self, build): + if self.INTERNAL_LINK: + return ['%s/ebur128/ebur128.c' % self.INTERNAL_PATH] -def configure(self, build, conf, env=None): - if env is None: - env = build.env - if not conf.CheckLib(['ebur128', 'libebur128']): - self.INTERNAL_LINK = True; - env.Append(CPPPATH=['%s/ebur128' % self.INTERNAL_PATH]) - #env.Append(CPPDEFINES='USE_SPEEX_RESAMPLER') # Required for unused EBUR128_MODE_TRUE_PEAK - if not conf.CheckHeader('sys/queue.h'): - env.Append(CPPPATH=['%s/ebur128/queue' % self.INTERNAL_PATH]) + def configure(self, build, conf, env=None): + if env is None: + env = build.env + if not conf.CheckLib(['ebur128', 'libebur128']): + self.INTERNAL_LINK = True; + env.Append(CPPPATH=['%s/ebur128' % self.INTERNAL_PATH]) + #env.Append(CPPDEFINES='USE_SPEEX_RESAMPLER') # Required for unused EBUR128_MODE_TRUE_PEAK + if not conf.CheckHeader('sys/queue.h'): + env.Append(CPPPATH=['%s/ebur128/queue' % self.INTERNAL_PATH]) class SoundTouch(Dependence): -SOUNDTOUCH_INTERNAL_PATH = '#lib/soundtouch-1.9.2' -INTERNAL_LINK = True - -def sources(self, build): - if self.INTERNAL_LINK: - return ['engine/enginebufferscalest.cpp', - '%s/AAFilter.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/BPMDetect.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/FIFOSampleBuffer.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/FIRFilter.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/InterpolateCubic.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/InterpolateLinear.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/InterpolateShannon.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/PeakFinder.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/RateTransposer.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/SoundTouch.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/TDStretch.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - # SoundTouch CPU optimizations are only for x86 - # architectures. SoundTouch automatically ignores these files - # when it is not being built for an architecture that supports - # them. - '%s/cpu_detect_x86.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/mmx_optimized.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, - '%s/sse_optimized.cpp' % self.SOUNDTOUCH_INTERNAL_PATH] - else: - return ['engine/enginebufferscalest.cpp'] - -def configure(self, build, conf, env=None): - if env is None: - env = build.env - - if build.platform_is_linux: - # Try using system lib - if conf.CheckForPKG('soundtouch', '1.8.0'): - # System Lib found - build.env.ParseConfig('pkg-config soundtouch --silence-errors \ - --cflags --libs') - self.INTERNAL_LINK = False - - if self.INTERNAL_LINK: - env.Append(CPPPATH=[self.SOUNDTOUCH_INTERNAL_PATH]) - - # Prevents circular import. - from features import Optimize - - # If we do not want optimizations then disable them. - optimize = (build.flags['optimize'] if 'optimize' in build.flags - else Optimize.get_optimization_level(build)) - if optimize == Optimize.LEVEL_OFF: - env.Append(CPPDEFINES='SOUNDTOUCH_DISABLE_X86_OPTIMIZATIONS') + SOUNDTOUCH_INTERNAL_PATH = '#lib/soundtouch-1.9.2' + INTERNAL_LINK = True + + def sources(self, build): + if self.INTERNAL_LINK: + return ['engine/enginebufferscalest.cpp', + '%s/AAFilter.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/BPMDetect.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/FIFOSampleBuffer.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/FIRFilter.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/InterpolateCubic.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/InterpolateLinear.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/InterpolateShannon.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/PeakFinder.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/RateTransposer.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/SoundTouch.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/TDStretch.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + # SoundTouch CPU optimizations are only for x86 + # architectures. SoundTouch automatically ignores these files + # when it is not being built for an architecture that supports + # them. + '%s/cpu_detect_x86.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/mmx_optimized.cpp' % self.SOUNDTOUCH_INTERNAL_PATH, + '%s/sse_optimized.cpp' % self.SOUNDTOUCH_INTERNAL_PATH] + else: + return ['engine/enginebufferscalest.cpp'] + + def configure(self, build, conf, env=None): + if env is None: + env = build.env + + if build.platform_is_linux: + # Try using system lib + if conf.CheckForPKG('soundtouch', '1.8.0'): + # System Lib found + build.env.ParseConfig('pkg-config soundtouch --silence-errors \ + --cflags --libs') + self.INTERNAL_LINK = False + + if self.INTERNAL_LINK: + env.Append(CPPPATH=[self.SOUNDTOUCH_INTERNAL_PATH]) + + # Prevents circular import. + from features import Optimize + + # If we do not want optimizations then disable them. + optimize = (build.flags['optimize'] if 'optimize' in build.flags + else Optimize.get_optimization_level(build)) + if optimize == Optimize.LEVEL_OFF: + env.Append(CPPDEFINES='SOUNDTOUCH_DISABLE_X86_OPTIMIZATIONS') class RubberBand(Dependence): -def sources(self, build): - sources = ['engine/enginebufferscalerubberband.cpp', ] - return sources + def sources(self, build): + sources = ['engine/enginebufferscalerubberband.cpp', ] + return sources -def configure(self, build, conf, env=None): - if env is None: - env = build.env - if not conf.CheckLib(['rubberband', 'librubberband']): - raise Exception( - "Could not find librubberband or its development headers.") + def configure(self, build, conf, env=None): + if env is None: + env = build.env + if not conf.CheckLib(['rubberband', 'librubberband']): + raise Exception( + "Could not find librubberband or its development headers.") class TagLib(Dependence): -def configure(self, build, conf): - libs = ['tag'] - if not conf.CheckLib(libs): - raise Exception( - "Could not find libtag or its development headers.") + def configure(self, build, conf): + libs = ['tag'] + if not conf.CheckLib(libs): + raise Exception( + "Could not find libtag or its development headers.") - # Karmic seems to have an issue with mp4tag.h where they don't include - # the files correctly. Adding this folder ot the include path should fix - # it, though might cause issues. This is safe to remove once we - # deprecate Karmic support. rryan 2/2011 - build.env.Append(CPPPATH='/usr/include/taglib/') + # Karmic seems to have an issue with mp4tag.h where they don't include + # the files correctly. Adding this folder ot the include path should fix + # it, though might cause issues. This is safe to remove once we + # deprecate Karmic support. rryan 2/2011 + build.env.Append(CPPPATH='/usr/include/taglib/') - if build.platform_is_windows and build.static_dependencies: - build.env.Append(CPPDEFINES='TAGLIB_STATIC') + if build.platform_is_windows and build.static_dependencies: + build.env.Append(CPPDEFINES='TAGLIB_STATIC') class Chromaprint(Dependence): -def configure(self, build, conf): - if not conf.CheckLib(['chromaprint', 'libchromaprint', 'chromaprint_p', 'libchromaprint_p']): - raise Exception( - "Could not find libchromaprint or its development headers.") - if build.platform_is_windows and build.static_dependencies: - build.env.Append(CPPDEFINES='CHROMAPRINT_NODLL') - - # On Windows, we link chromaprint with FFTW3. - if not conf.CheckLib(['fftw', 'libfftw', 'fftw3', 'libfftw3', 'libfftw-3.3']): + def configure(self, build, conf): + if not conf.CheckLib(['chromaprint', 'libchromaprint', 'chromaprint_p', 'libchromaprint_p']): raise Exception( - "Could not find fftw3 or its development headers.") + "Could not find libchromaprint or its development headers.") + if build.platform_is_windows and build.static_dependencies: + build.env.Append(CPPDEFINES='CHROMAPRINT_NODLL') + + # On Windows, we link chromaprint with FFTW3. + if not conf.CheckLib(['fftw', 'libfftw', 'fftw3', 'libfftw3', 'libfftw-3.3']): + raise Exception( + "Could not find fftw3 or its development headers.") class ProtoBuf(Dependence): -def configure(self, build, conf): - libs = ['libprotobuf-lite', 'protobuf-lite', 'libprotobuf', 'protobuf'] - if build.platform_is_windows: - if not build.static_dependencies: - build.env.Append(CPPDEFINES='PROTOBUF_USE_DLLS') - if not conf.CheckLib(libs): - raise Exception( - "Could not find libprotobuf or its development headers.") + def configure(self, build, conf): + libs = ['libprotobuf-lite', 'protobuf-lite', 'libprotobuf', 'protobuf'] + if build.platform_is_windows: + if not build.static_dependencies: + build.env.Append(CPPDEFINES='PROTOBUF_USE_DLLS') + if not conf.CheckLib(libs): + raise Exception( + "Could not find libprotobuf or its development headers.") class FpClassify(Dependence): -def enabled(self, build): - return build.toolchain_is_gnu + def enabled(self, build): + return build.toolchain_is_gnu -# This is a wrapper arround the fpclassify function that pevents inlining -# It is compiled without optimization and allows to use these function -# from -ffast-math optimized objects -def sources(self, build): - # add this file without fast-math flag - env = build.env.Clone() - if '-ffast-math' in env['CCFLAGS']: - env['CCFLAGS'].remove('-ffast-math') - return env.Object('util/fpclassify.cpp') + # This is a wrapper arround the fpclassify function that pevents inlining + # It is compiled without optimization and allows to use these function + # from -ffast-math optimized objects + def sources(self, build): + # add this file without fast-math flag + env = build.env.Clone() + if '-ffast-math' in env['CCFLAGS']: + env['CCFLAGS'].remove('-ffast-math') + return env.Object('util/fpclassify.cpp') class QtScriptByteArray(Dependence): -def configure(self, build, conf): - build.env.Append(CPPPATH='#lib/qtscript-bytearray') + def configure(self, build, conf): + build.env.Append(CPPPATH='#lib/qtscript-bytearray') -def sources(self, build): - return ['#lib/qtscript-bytearray/bytearrayclass.cpp', - '#lib/qtscript-bytearray/bytearrayprototype.cpp'] + def sources(self, build): + return ['#lib/qtscript-bytearray/bytearrayclass.cpp', + '#lib/qtscript-bytearray/bytearrayprototype.cpp'] class PortAudioRingBuffer(Dependence): -def configure(self, build, conf): - build.env.Append(CPPPATH='#lib/portaudio') + def configure(self, build, conf): + build.env.Append(CPPPATH='#lib/portaudio') -def sources(self, build): - return ['#lib/portaudio/pa_ringbuffer.c'] + def sources(self, build): + return ['#lib/portaudio/pa_ringbuffer.c'] class Reverb(Dependence): -def configure(self, build, conf): - build.env.Append(CPPPATH='#lib/reverb') + def configure(self, build, conf): + build.env.Append(CPPPATH='#lib/reverb') -def sources(self, build): - return ['#lib/reverb/Reverb.cc'] + def sources(self, build): + return ['#lib/reverb/Reverb.cc'] class MixxxCore(Feature): -def description(self): - return "Mixxx Core Features" - -def enabled(self, build): - return True - -def sources(self, build): - sources = ["control/control.cpp", - "control/controlaudiotaperpot.cpp", - "control/controlbehavior.cpp", - "control/controleffectknob.cpp", - "control/controlindicator.cpp", - "control/controllinpotmeter.cpp", - "control/controllogpotmeter.cpp", - "control/controlmodel.cpp", - "control/controlobject.cpp", - "control/controlobjectscript.cpp", - "control/controlpotmeter.cpp", - "control/controlproxy.cpp", - "control/controlpushbutton.cpp", - "control/controlttrotary.cpp", - - "controllers/dlgcontrollerlearning.cpp", - "controllers/dlgprefcontroller.cpp", - "controllers/dlgprefcontrollers.cpp", - "dialog/dlgabout.cpp", - "dialog/dlgdevelopertools.cpp", - - "preferences/configobject.cpp", - "preferences/dialog/dlgprefautodj.cpp", - "preferences/dialog/dlgprefcontrols.cpp", - "preferences/dialog/dlgprefcrossfader.cpp", - "preferences/dialog/dlgprefeffects.cpp", - "preferences/dialog/dlgprefeq.cpp", - "preferences/dialog/dlgpreferences.cpp", - "preferences/dialog/dlgpreflibrary.cpp", - "preferences/dialog/dlgprefnovinyl.cpp", - "preferences/dialog/dlgprefrecord.cpp", - "preferences/dialog/dlgprefreplaygain.cpp", - "preferences/dialog/dlgprefsound.cpp", - "preferences/dialog/dlgprefsounditem.cpp", - "preferences/dialog/dlgprefwaveform.cpp", - "preferences/settingsmanager.cpp", - "preferences/replaygainsettings.cpp", - "preferences/broadcastsettings.cpp", - "preferences/upgrade.cpp", - "preferences/dlgpreferencepage.cpp", - - - "effects/effectmanifest.cpp", - "effects/effectmanifestparameter.cpp", - - "effects/effectchain.cpp", - "effects/effect.cpp", - "effects/effectparameter.cpp", - - "effects/effectrack.cpp", - "effects/effectchainslot.cpp", - "effects/effectslot.cpp", - "effects/effectparameterslotbase.cpp", - "effects/effectparameterslot.cpp", - "effects/effectbuttonparameterslot.cpp", - - "effects/effectsmanager.cpp", - "effects/effectchainmanager.cpp", - "effects/effectsbackend.cpp", - - "effects/native/nativebackend.cpp", - "effects/native/bitcrushereffect.cpp", - "effects/native/linkwitzriley8eqeffect.cpp", - "effects/native/bessel4lvmixeqeffect.cpp", - "effects/native/bessel8lvmixeqeffect.cpp", - "effects/native/threebandbiquadeqeffect.cpp", - "effects/native/biquadfullkilleqeffect.cpp", - "effects/native/loudnesscontoureffect.cpp", - "effects/native/graphiceqeffect.cpp", - "effects/native/flangereffect.cpp", - "effects/native/filtereffect.cpp", - "effects/native/moogladder4filtereffect.cpp", - "effects/native/reverbeffect.cpp", - "effects/native/echoeffect.cpp", - "effects/native/autopaneffect.cpp", - "effects/native/phasereffect.cpp", - - "engine/effects/engineeffectsmanager.cpp", - "engine/effects/engineeffectrack.cpp", - "engine/effects/engineeffectchain.cpp", - "engine/effects/engineeffect.cpp", - - "engine/sync/basesyncablelistener.cpp", - "engine/sync/enginesync.cpp", - "engine/sync/synccontrol.cpp", - "engine/sync/internalclock.cpp", - - "engine/engineworker.cpp", - "engine/engineworkerscheduler.cpp", - "engine/enginebuffer.cpp", - "engine/enginebufferscale.cpp", - "engine/enginebufferscalelinear.cpp", - "engine/enginefilterbiquad1.cpp", - "engine/enginefiltermoogladder4.cpp", - "engine/enginefilterbessel4.cpp", - "engine/enginefilterbessel8.cpp", - "engine/enginefilterbutterworth4.cpp", - "engine/enginefilterbutterworth8.cpp", - "engine/enginefilterlinkwitzriley4.cpp", - "engine/enginefilterlinkwitzriley8.cpp", - "engine/enginefilter.cpp", - "engine/engineobject.cpp", - "engine/enginepregain.cpp", - "engine/enginechannel.cpp", - "engine/enginemaster.cpp", - "engine/enginedelay.cpp", - "engine/enginevumeter.cpp", - "engine/enginesidechaincompressor.cpp", - "engine/sidechain/enginesidechain.cpp", - "engine/sidechain/networkstreamworker.cpp", - "engine/enginexfader.cpp", - "engine/enginemicrophone.cpp", - "engine/enginedeck.cpp", - "engine/engineaux.cpp", - "engine/channelmixer_autogen.cpp", - - "engine/enginecontrol.cpp", - "engine/ratecontrol.cpp", - "engine/positionscratchcontroller.cpp", - "engine/loopingcontrol.cpp", - "engine/bpmcontrol.cpp", - "engine/keycontrol.cpp", - "engine/cuecontrol.cpp", - "engine/quantizecontrol.cpp", - "engine/clockcontrol.cpp", - "engine/readaheadmanager.cpp", - "engine/enginetalkoverducking.cpp", - "engine/cachingreader.cpp", - "engine/cachingreaderchunk.cpp", - "engine/cachingreaderworker.cpp", - - "analyzer/analyzerqueue.cpp", - "analyzer/analyzerwaveform.cpp", - "analyzer/analyzergain.cpp", - "analyzer/analyzerebur128.cpp", - - "controllers/controller.cpp", - "controllers/controllerengine.cpp", - "controllers/controllerenumerator.cpp", - "controllers/controllerlearningeventfilter.cpp", - "controllers/controllermanager.cpp", - "controllers/controllerpresetfilehandler.cpp", - "controllers/controllerpresetinfo.cpp", - "controllers/controllerpresetinfoenumerator.cpp", - "controllers/controlpickermenu.cpp", - "controllers/controllermappingtablemodel.cpp", - "controllers/controllerinputmappingtablemodel.cpp", - "controllers/controlleroutputmappingtablemodel.cpp", - "controllers/delegates/controldelegate.cpp", - "controllers/delegates/midichanneldelegate.cpp", - "controllers/delegates/midiopcodedelegate.cpp", - "controllers/delegates/midibytedelegate.cpp", - "controllers/delegates/midioptionsdelegate.cpp", - "controllers/learningutils.cpp", - "controllers/midi/midimessage.cpp", - "controllers/midi/midiutils.cpp", - "controllers/midi/midicontroller.cpp", - "controllers/midi/midicontrollerpresetfilehandler.cpp", - "controllers/midi/midienumerator.cpp", - "controllers/midi/midioutputhandler.cpp", - "controllers/softtakeover.cpp", - "controllers/keyboard/keyboardeventfilter.cpp", - - "main.cpp", - "mixxx.cpp", - "mixxxapplication.cpp", - "errordialoghandler.cpp", - - "sources/audiosource.cpp", - "sources/soundsource.cpp", - "sources/soundsourceplugin.cpp", - "sources/soundsourcepluginlibrary.cpp", - "sources/soundsourceproviderregistry.cpp", - "sources/soundsourceproxy.cpp", - - "widget/controlwidgetconnection.cpp", - "widget/wbasewidget.cpp", - "widget/wwidget.cpp", - "widget/wwidgetgroup.cpp", - "widget/wwidgetstack.cpp", - "widget/wsizeawarestack.cpp", - "widget/wlabel.cpp", - "widget/wtracktext.cpp", - "widget/wnumber.cpp", - "widget/wnumberdb.cpp", - "widget/wnumberpos.cpp", - "widget/wnumberrate.cpp", - "widget/wknob.cpp", - "widget/wknobcomposed.cpp", - "widget/wdisplay.cpp", - "widget/wvumeter.cpp", - "widget/wpushbutton.cpp", - "widget/weffectpushbutton.cpp", - "widget/wslidercomposed.cpp", - "widget/wstatuslight.cpp", - "widget/woverview.cpp", - "widget/woverviewlmh.cpp", - "widget/woverviewhsv.cpp", - "widget/woverviewrgb.cpp", - "widget/wspinny.cpp", - "widget/wskincolor.cpp", - "widget/wsearchlineedit.cpp", - "widget/wpixmapstore.cpp", - "widget/wimagestore.cpp", - "widget/hexspinbox.cpp", - "widget/wtrackproperty.cpp", - "widget/wstarrating.cpp", - "widget/weffectchain.cpp", - "widget/weffect.cpp", - "widget/weffectselector.cpp", - "widget/weffectparameter.cpp", - "widget/weffectbuttonparameter.cpp", - "widget/weffectparameterbase.cpp", - "widget/wtime.cpp", - "widget/wrecordingduration.cpp", - "widget/wkey.cpp", - "widget/wbattery.cpp", - "widget/wcombobox.cpp", - "widget/wsplitter.cpp", - "widget/wcoverart.cpp", - "widget/wcoverartlabel.cpp", - "widget/wcoverartmenu.cpp", - "widget/wsingletoncontainer.cpp", - "widget/wmainmenubar.cpp", - - "musicbrainz/network.cpp", - "musicbrainz/tagfetcher.cpp", - "musicbrainz/gzip.cpp", - "musicbrainz/crc.c", - "musicbrainz/acoustidclient.cpp", - "musicbrainz/chromaprinter.cpp", - "musicbrainz/musicbrainzclient.cpp", - - "widget/wtracktableview.cpp", - "widget/wtracktableviewheader.cpp", - "widget/wlibrarysidebar.cpp", - "widget/wlibrary.cpp", - "widget/wlibrarytableview.cpp", - "widget/wanalysislibrarytableview.cpp", - "widget/wlibrarytextbrowser.cpp", - "library/trackcollection.cpp", - "library/basesqltablemodel.cpp", - "library/basetrackcache.cpp", - "library/columncache.cpp", - "library/librarytablemodel.cpp", - "library/searchquery.cpp", - "library/searchqueryparser.cpp", - "library/analysislibrarytablemodel.cpp", - "library/missingtablemodel.cpp", - "library/hiddentablemodel.cpp", - "library/proxytrackmodel.cpp", - "library/coverart.cpp", - "library/coverartcache.cpp", - "library/coverartutils.cpp", - - "library/crate/cratestorage.cpp", - "library/crate/cratefeature.cpp", - "library/crate/cratefeaturehelper.cpp", - "library/crate/cratetablemodel.cpp", - - "library/playlisttablemodel.cpp", - "library/libraryfeature.cpp", - "library/analysisfeature.cpp", - "library/autodj/autodjfeature.cpp", - "library/autodj/autodjprocessor.cpp", - "library/dao/directorydao.cpp", - "library/mixxxlibraryfeature.cpp", - "library/baseplaylistfeature.cpp", - "library/playlistfeature.cpp", - "library/setlogfeature.cpp", - "library/autodj/dlgautodj.cpp", - "library/dlganalysis.cpp", - "library/dlgcoverartfullsize.cpp", - "library/dlghidden.cpp", - "library/dlgmissing.cpp", - "library/dlgtagfetcher.cpp", - "library/dlgtrackinfo.cpp", - - "library/browse/browsetablemodel.cpp", - "library/browse/browsethread.cpp", - "library/browse/browsefeature.cpp", - "library/browse/foldertreemodel.cpp", - - "library/export/trackexportdlg.cpp", - "library/export/trackexportwizard.cpp", - "library/export/trackexportworker.cpp", - - "library/recording/recordingfeature.cpp", - "library/recording/dlgrecording.cpp", - "recording/recordingmanager.cpp", - "engine/sidechain/enginerecord.cpp", - - # External Library Features - "library/baseexternallibraryfeature.cpp", - "library/baseexternaltrackmodel.cpp", - "library/baseexternalplaylistmodel.cpp", - "library/rhythmbox/rhythmboxfeature.cpp", - - "library/banshee/bansheefeature.cpp", - "library/banshee/bansheeplaylistmodel.cpp", - "library/banshee/bansheedbconnection.cpp", - - "library/itunes/itunesfeature.cpp", - "library/traktor/traktorfeature.cpp", - - "library/sidebarmodel.cpp", - "library/library.cpp", - - "library/scanner/libraryscanner.cpp", - "library/scanner/libraryscannerdlg.cpp", - "library/scanner/scannertask.cpp", - "library/scanner/importfilestask.cpp", - "library/scanner/recursivescandirectorytask.cpp", - - "library/dao/cuedao.cpp", - "library/dao/cue.cpp", - "library/dao/trackdao.cpp", - "library/dao/playlistdao.cpp", - "library/dao/libraryhashdao.cpp", - "library/dao/settingsdao.cpp", - "library/dao/analysisdao.cpp", - "library/dao/autodjcratesdao.cpp", - - "library/librarycontrol.cpp", - "library/schemamanager.cpp", - "library/songdownloader.cpp", - "library/starrating.cpp", - "library/stardelegate.cpp", - "library/stareditor.cpp", - "library/bpmdelegate.cpp", - "library/previewbuttondelegate.cpp", - "library/coverartdelegate.cpp", - - "library/treeitemmodel.cpp", - "library/treeitem.cpp", - - "library/parser.cpp", - "library/parserpls.cpp", - "library/parserm3u.cpp", - "library/parsercsv.cpp", - - "widget/wwaveformviewer.cpp", - - "waveform/sharedglcontext.cpp", - "waveform/waveform.cpp", - "waveform/waveformfactory.cpp", - "waveform/waveformwidgetfactory.cpp", - "waveform/vsyncthread.cpp", - "waveform/guitick.cpp", - "waveform/visualplayposition.cpp", - "waveform/renderers/waveformwidgetrenderer.cpp", - "waveform/renderers/waveformrendererabstract.cpp", - "waveform/renderers/waveformrenderbackground.cpp", - "waveform/renderers/waveformrendermark.cpp", - "waveform/renderers/waveformrendermarkrange.cpp", - "waveform/renderers/waveformrenderbeat.cpp", - "waveform/renderers/waveformrendererendoftrack.cpp", - "waveform/renderers/waveformrendererpreroll.cpp", - - "waveform/renderers/waveformrendererfilteredsignal.cpp", - "waveform/renderers/waveformrendererhsv.cpp", - "waveform/renderers/waveformrendererrgb.cpp", - "waveform/renderers/qtwaveformrendererfilteredsignal.cpp", - "waveform/renderers/qtwaveformrenderersimplesignal.cpp", - - "waveform/renderers/waveformsignalcolors.cpp", - - "waveform/renderers/waveformrenderersignalbase.cpp", - "waveform/renderers/waveformmark.cpp", - "waveform/renderers/waveformmarkproperties.cpp", - "waveform/renderers/waveformmarkset.cpp", - "waveform/renderers/waveformmarkrange.cpp", - "waveform/renderers/glwaveformrenderersimplesignal.cpp", - "waveform/renderers/glwaveformrendererrgb.cpp", - "waveform/renderers/glwaveformrendererfilteredsignal.cpp", - "waveform/renderers/glslwaveformrenderersignal.cpp", - "waveform/renderers/glvsynctestrenderer.cpp", - - "waveform/widgets/waveformwidgetabstract.cpp", - "waveform/widgets/emptywaveformwidget.cpp", - "waveform/widgets/softwarewaveformwidget.cpp", - "waveform/widgets/hsvwaveformwidget.cpp", - "waveform/widgets/rgbwaveformwidget.cpp", - "waveform/widgets/qtwaveformwidget.cpp", - "waveform/widgets/qtsimplewaveformwidget.cpp", - "waveform/widgets/glwaveformwidget.cpp", - "waveform/widgets/glsimplewaveformwidget.cpp", - "waveform/widgets/glvsynctestwidget.cpp", - - "waveform/widgets/glslwaveformwidget.cpp", - - "waveform/widgets/glrgbwaveformwidget.cpp", - - "skin/imginvert.cpp", - "skin/imgloader.cpp", - "skin/imgcolor.cpp", - "skin/skinloader.cpp", - "skin/legacyskinparser.cpp", - "skin/colorschemeparser.cpp", - "skin/tooltips.cpp", - "skin/skincontext.cpp", - "skin/svgparser.cpp", - "skin/pixmapsource.cpp", - "skin/launchimage.cpp", - - "track/beatfactory.cpp", - "track/beatgrid.cpp", - "track/beatmap.cpp", - "track/beatutils.cpp", - "track/bpm.cpp", - "track/keyfactory.cpp", - "track/keys.cpp", - "track/keyutils.cpp", - "track/playcounter.cpp", - "track/replaygain.cpp", - "track/track.cpp", - "track/trackmetadata.cpp", - "track/trackmetadatataglib.cpp", - "track/tracknumbers.cpp", - - "mixer/auxiliary.cpp", - "mixer/baseplayer.cpp", - "mixer/basetrackplayer.cpp", - "mixer/deck.cpp", - "mixer/microphone.cpp", - "mixer/playerinfo.cpp", - "mixer/playermanager.cpp", - "mixer/previewdeck.cpp", - "mixer/sampler.cpp", - "mixer/samplerbank.cpp", - - "soundio/sounddevice.cpp", - "soundio/sounddevicenetwork.cpp", - "engine/sidechain/enginenetworkstream.cpp", - "soundio/soundmanager.cpp", - "soundio/soundmanagerconfig.cpp", - "soundio/soundmanagerutil.cpp", - - "encoder/encoder.cpp", - "encoder/encodermp3.cpp", - "encoder/encodervorbis.cpp", - - "util/sleepableqthread.cpp", - "util/statsmanager.cpp", - "util/stat.cpp", - "util/statmodel.cpp", - "util/duration.cpp", - "util/time.cpp", - "util/timer.cpp", - "util/performancetimer.cpp", - "util/threadcputimer.cpp", - "util/version.cpp", - "util/rlimit.cpp", - "util/battery/battery.cpp", - "util/valuetransformer.cpp", - "util/sandbox.cpp", - "util/file.cpp", - "util/mac.cpp", - "util/task.cpp", - "util/experiment.cpp", - "util/xml.cpp", - "util/tapfilter.cpp", - "util/movinginterquartilemean.cpp", - "util/console.cpp", - "util/db/dbconnection.cpp", - "util/db/dbid.cpp", - "util/db/fwdsqlquery.cpp", - "util/db/fwdsqlqueryselectresult.cpp", - "util/db/sqllikewildcardescaper.cpp", - "util/db/sqlqueryfinisher.cpp", - "util/db/sqlstringformatter.cpp", - "util/db/sqltransaction.cpp", - "util/sample.cpp", - "util/samplebuffer.cpp", - "util/singularsamplebuffer.cpp", - "util/circularsamplebuffer.cpp", - "util/rotary.cpp", - "util/logging.cpp", - "util/cmdlineargs.cpp", - "util/audiosignal.cpp", - "util/screensaver.cpp", - "util/autohidpi.cpp", - - '#res/mixxx.qrc' + def description(self): + return "Mixxx Core Features" + + def enabled(self, build): + return True + + def sources(self, build): + sources = ["control/control.cpp", + "control/controlaudiotaperpot.cpp", + "control/controlbehavior.cpp", + "control/controleffectknob.cpp", + "control/controlindicator.cpp", + "control/controllinpotmeter.cpp", + "control/controllogpotmeter.cpp", + "control/controlmodel.cpp", + "control/controlobject.cpp", + "control/controlobjectscript.cpp", + "control/controlpotmeter.cpp", + "control/controlproxy.cpp", + "control/controlpushbutton.cpp", + "control/controlttrotary.cpp", + + "controllers/dlgcontrollerlearning.cpp", + "controllers/dlgprefcontroller.cpp", + "controllers/dlgprefcontrollers.cpp", + "dialog/dlgabout.cpp", + "dialog/dlgdevelopertools.cpp", + + "preferences/configobject.cpp", + "preferences/dialog/dlgprefautodj.cpp", + "preferences/dialog/dlgprefcontrols.cpp", + "preferences/dialog/dlgprefcrossfader.cpp", + "preferences/dialog/dlgprefeffects.cpp", + "preferences/dialog/dlgprefeq.cpp", + "preferences/dialog/dlgpreferences.cpp", + "preferences/dialog/dlgpreflibrary.cpp", + "preferences/dialog/dlgprefnovinyl.cpp", + "preferences/dialog/dlgprefrecord.cpp", + "preferences/dialog/dlgprefreplaygain.cpp", + "preferences/dialog/dlgprefsound.cpp", + "preferences/dialog/dlgprefsounditem.cpp", + "preferences/dialog/dlgprefwaveform.cpp", + "preferences/settingsmanager.cpp", + "preferences/replaygainsettings.cpp", + "preferences/broadcastsettings.cpp", + "preferences/upgrade.cpp", + "preferences/dlgpreferencepage.cpp", + + + "effects/effectmanifest.cpp", + "effects/effectmanifestparameter.cpp", + + "effects/effectchain.cpp", + "effects/effect.cpp", + "effects/effectparameter.cpp", + + "effects/effectrack.cpp", + "effects/effectchainslot.cpp", + "effects/effectslot.cpp", + "effects/effectparameterslotbase.cpp", + "effects/effectparameterslot.cpp", + "effects/effectbuttonparameterslot.cpp", + + "effects/effectsmanager.cpp", + "effects/effectchainmanager.cpp", + "effects/effectsbackend.cpp", + + "effects/native/nativebackend.cpp", + "effects/native/bitcrushereffect.cpp", + "effects/native/linkwitzriley8eqeffect.cpp", + "effects/native/bessel4lvmixeqeffect.cpp", + "effects/native/bessel8lvmixeqeffect.cpp", + "effects/native/threebandbiquadeqeffect.cpp", + "effects/native/biquadfullkilleqeffect.cpp", + "effects/native/loudnesscontoureffect.cpp", + "effects/native/graphiceqeffect.cpp", + "effects/native/flangereffect.cpp", + "effects/native/filtereffect.cpp", + "effects/native/moogladder4filtereffect.cpp", + "effects/native/reverbeffect.cpp", + "effects/native/echoeffect.cpp", + "effects/native/autopaneffect.cpp", + "effects/native/phasereffect.cpp", + + "engine/effects/engineeffectsmanager.cpp", + "engine/effects/engineeffectrack.cpp", + "engine/effects/engineeffectchain.cpp", + "engine/effects/engineeffect.cpp", + + "engine/sync/basesyncablelistener.cpp", + "engine/sync/enginesync.cpp", + "engine/sync/synccontrol.cpp", + "engine/sync/internalclock.cpp", + + "engine/engineworker.cpp", + "engine/engineworkerscheduler.cpp", + "engine/enginebuffer.cpp", + "engine/enginebufferscale.cpp", + "engine/enginebufferscalelinear.cpp", + "engine/enginefilterbiquad1.cpp", + "engine/enginefiltermoogladder4.cpp", + "engine/enginefilterbessel4.cpp", + "engine/enginefilterbessel8.cpp", + "engine/enginefilterbutterworth4.cpp", + "engine/enginefilterbutterworth8.cpp", + "engine/enginefilterlinkwitzriley4.cpp", + "engine/enginefilterlinkwitzriley8.cpp", + "engine/enginefilter.cpp", + "engine/engineobject.cpp", + "engine/enginepregain.cpp", + "engine/enginechannel.cpp", + "engine/enginemaster.cpp", + "engine/enginedelay.cpp", + "engine/enginevumeter.cpp", + "engine/enginesidechaincompressor.cpp", + "engine/sidechain/enginesidechain.cpp", + "engine/sidechain/networkstreamworker.cpp", + "engine/enginexfader.cpp", + "engine/enginemicrophone.cpp", + "engine/enginedeck.cpp", + "engine/engineaux.cpp", + "engine/channelmixer_autogen.cpp", + + "engine/enginecontrol.cpp", + "engine/ratecontrol.cpp", + "engine/positionscratchcontroller.cpp", + "engine/loopingcontrol.cpp", + "engine/bpmcontrol.cpp", + "engine/keycontrol.cpp", + "engine/cuecontrol.cpp", + "engine/quantizecontrol.cpp", + "engine/clockcontrol.cpp", + "engine/readaheadmanager.cpp", + "engine/enginetalkoverducking.cpp", + "engine/cachingreader.cpp", + "engine/cachingreaderchunk.cpp", + "engine/cachingreaderworker.cpp", + + "analyzer/analyzerqueue.cpp", + "analyzer/analyzerwaveform.cpp", + "analyzer/analyzergain.cpp", + "analyzer/analyzerebur128.cpp", + + "controllers/controller.cpp", + "controllers/controllerengine.cpp", + "controllers/controllerenumerator.cpp", + "controllers/controllerlearningeventfilter.cpp", + "controllers/controllermanager.cpp", + "controllers/controllerpresetfilehandler.cpp", + "controllers/controllerpresetinfo.cpp", + "controllers/controllerpresetinfoenumerator.cpp", + "controllers/controlpickermenu.cpp", + "controllers/controllermappingtablemodel.cpp", + "controllers/controllerinputmappingtablemodel.cpp", + "controllers/controlleroutputmappingtablemodel.cpp", + "controllers/delegates/controldelegate.cpp", + "controllers/delegates/midichanneldelegate.cpp", + "controllers/delegates/midiopcodedelegate.cpp", + "controllers/delegates/midibytedelegate.cpp", + "controllers/delegates/midioptionsdelegate.cpp", + "controllers/learningutils.cpp", + "controllers/midi/midimessage.cpp", + "controllers/midi/midiutils.cpp", + "controllers/midi/midicontroller.cpp", + "controllers/midi/midicontrollerpresetfilehandler.cpp", + "controllers/midi/midienumerator.cpp", + "controllers/midi/midioutputhandler.cpp", + "controllers/softtakeover.cpp", + "controllers/keyboard/keyboardeventfilter.cpp", + + "main.cpp", + "mixxx.cpp", + "mixxxapplication.cpp", + "errordialoghandler.cpp", + + "sources/audiosource.cpp", + "sources/soundsource.cpp", + "sources/soundsourceplugin.cpp", + "sources/soundsourcepluginlibrary.cpp", + "sources/soundsourceproviderregistry.cpp", + "sources/soundsourceproxy.cpp", + + "widget/controlwidgetconnection.cpp", + "widget/wbasewidget.cpp", + "widget/wwidget.cpp", + "widget/wwidgetgroup.cpp", + "widget/wwidgetstack.cpp", + "widget/wsizeawarestack.cpp", + "widget/wlabel.cpp", + "widget/wtracktext.cpp", + "widget/wnumber.cpp", + "widget/wnumberdb.cpp", + "widget/wnumberpos.cpp", + "widget/wnumberrate.cpp", + "widget/wknob.cpp", + "widget/wknobcomposed.cpp", + "widget/wdisplay.cpp", + "widget/wvumeter.cpp", + "widget/wpushbutton.cpp", + "widget/weffectpushbutton.cpp", + "widget/wslidercomposed.cpp", + "widget/wstatuslight.cpp", + "widget/woverview.cpp", + "widget/woverviewlmh.cpp", + "widget/woverviewhsv.cpp", + "widget/woverviewrgb.cpp", + "widget/wspinny.cpp", + "widget/wskincolor.cpp", + "widget/wsearchlineedit.cpp", + "widget/wpixmapstore.cpp", + "widget/wimagestore.cpp", + "widget/hexspinbox.cpp", + "widget/wtrackproperty.cpp", + "widget/wstarrating.cpp", + "widget/weffectchain.cpp", + "widget/weffect.cpp", + "widget/weffectselector.cpp", + "widget/weffectparameter.cpp", + "widget/weffectbuttonparameter.cpp", + "widget/weffectparameterbase.cpp", + "widget/wtime.cpp", + "widget/wrecordingduration.cpp", + "widget/wkey.cpp", + "widget/wbattery.cpp", + "widget/wcombobox.cpp", + "widget/wsplitter.cpp", + "widget/wcoverart.cpp", + "widget/wcoverartlabel.cpp", + "widget/wcoverartmenu.cpp", + "widget/wsingletoncontainer.cpp", + "widget/wmainmenubar.cpp", + + "musicbrainz/network.cpp", + "musicbrainz/tagfetcher.cpp", + "musicbrainz/gzip.cpp", + "musicbrainz/crc.c", + "musicbrainz/acoustidclient.cpp", + "musicbrainz/chromaprinter.cpp", + "musicbrainz/musicbrainzclient.cpp", + + "widget/wtracktableview.cpp", + "widget/wtracktableviewheader.cpp", + "widget/wlibrarysidebar.cpp", + "widget/wlibrary.cpp", + "widget/wlibrarytableview.cpp", + "widget/wanalysislibrarytableview.cpp", + "widget/wlibrarytextbrowser.cpp", + "library/trackcollection.cpp", + "library/basesqltablemodel.cpp", + "library/basetrackcache.cpp", + "library/columncache.cpp", + "library/librarytablemodel.cpp", + "library/searchquery.cpp", + "library/searchqueryparser.cpp", + "library/analysislibrarytablemodel.cpp", + "library/missingtablemodel.cpp", + "library/hiddentablemodel.cpp", + "library/proxytrackmodel.cpp", + "library/coverart.cpp", + "library/coverartcache.cpp", + "library/coverartutils.cpp", + + "library/crate/cratestorage.cpp", + "library/crate/cratefeature.cpp", + "library/crate/cratefeaturehelper.cpp", + "library/crate/cratetablemodel.cpp", + + "library/playlisttablemodel.cpp", + "library/libraryfeature.cpp", + "library/analysisfeature.cpp", + "library/autodj/autodjfeature.cpp", + "library/autodj/autodjprocessor.cpp", + "library/dao/directorydao.cpp", + "library/mixxxlibraryfeature.cpp", + "library/baseplaylistfeature.cpp", + "library/playlistfeature.cpp", + "library/setlogfeature.cpp", + "library/autodj/dlgautodj.cpp", + "library/dlganalysis.cpp", + "library/dlgcoverartfullsize.cpp", + "library/dlghidden.cpp", + "library/dlgmissing.cpp", + "library/dlgtagfetcher.cpp", + "library/dlgtrackinfo.cpp", + + "library/browse/browsetablemodel.cpp", + "library/browse/browsethread.cpp", + "library/browse/browsefeature.cpp", + "library/browse/foldertreemodel.cpp", + + "library/export/trackexportdlg.cpp", + "library/export/trackexportwizard.cpp", + "library/export/trackexportworker.cpp", + + "library/recording/recordingfeature.cpp", + "library/recording/dlgrecording.cpp", + "recording/recordingmanager.cpp", + "engine/sidechain/enginerecord.cpp", + + # External Library Features + "library/baseexternallibraryfeature.cpp", + "library/baseexternaltrackmodel.cpp", + "library/baseexternalplaylistmodel.cpp", + "library/rhythmbox/rhythmboxfeature.cpp", + + "library/banshee/bansheefeature.cpp", + "library/banshee/bansheeplaylistmodel.cpp", + "library/banshee/bansheedbconnection.cpp", + + "library/itunes/itunesfeature.cpp", + "library/traktor/traktorfeature.cpp", + + "library/sidebarmodel.cpp", + "library/library.cpp", + + "library/scanner/libraryscanner.cpp", + "library/scanner/libraryscannerdlg.cpp", + "library/scanner/scannertask.cpp", + "library/scanner/importfilestask.cpp", + "library/scanner/recursivescandirectorytask.cpp", + + "library/dao/cuedao.cpp", + "library/dao/cue.cpp", + "library/dao/trackdao.cpp", + "library/dao/playlistdao.cpp", + "library/dao/libraryhashdao.cpp", + "library/dao/settingsdao.cpp", + "library/dao/analysisdao.cpp", + "library/dao/autodjcratesdao.cpp", + + "library/librarycontrol.cpp", + "library/schemamanager.cpp", + "library/songdownloader.cpp", + "library/starrating.cpp", + "library/stardelegate.cpp", + "library/stareditor.cpp", + "library/bpmdelegate.cpp", + "library/previewbuttondelegate.cpp", + "library/coverartdelegate.cpp", + + "library/treeitemmodel.cpp", + "library/treeitem.cpp", + + "library/parser.cpp", + "library/parserpls.cpp", + "library/parserm3u.cpp", + "library/parsercsv.cpp", + + "widget/wwaveformviewer.cpp", + + "waveform/sharedglcontext.cpp", + "waveform/waveform.cpp", + "waveform/waveformfactory.cpp", + "waveform/waveformwidgetfactory.cpp", + "waveform/vsyncthread.cpp", + "waveform/guitick.cpp", + "waveform/visualplayposition.cpp", + "waveform/renderers/waveformwidgetrenderer.cpp", + "waveform/renderers/waveformrendererabstract.cpp", + "waveform/renderers/waveformrenderbackground.cpp", + "waveform/renderers/waveformrendermark.cpp", + "waveform/renderers/waveformrendermarkrange.cpp", + "waveform/renderers/waveformrenderbeat.cpp", + "waveform/renderers/waveformrendererendoftrack.cpp", + "waveform/renderers/waveformrendererpreroll.cpp", + + "waveform/renderers/waveformrendererfilteredsignal.cpp", + "waveform/renderers/waveformrendererhsv.cpp", + "waveform/renderers/waveformrendererrgb.cpp", + "waveform/renderers/qtwaveformrendererfilteredsignal.cpp", + "waveform/renderers/qtwaveformrenderersimplesignal.cpp", + + "waveform/renderers/waveformsignalcolors.cpp", + + "waveform/renderers/waveformrenderersignalbase.cpp", + "waveform/renderers/waveformmark.cpp", + "waveform/renderers/waveformmarkproperties.cpp", + "waveform/renderers/waveformmarkset.cpp", + "waveform/renderers/waveformmarkrange.cpp", + "waveform/renderers/glwaveformrenderersimplesignal.cpp", + "waveform/renderers/glwaveformrendererrgb.cpp", + "waveform/renderers/glwaveformrendererfilteredsignal.cpp", + "waveform/renderers/glslwaveformrenderersignal.cpp", + "waveform/renderers/glvsynctestrenderer.cpp", + + "waveform/widgets/waveformwidgetabstract.cpp", + "waveform/widgets/emptywaveformwidget.cpp", + "waveform/widgets/softwarewaveformwidget.cpp", + "waveform/widgets/hsvwaveformwidget.cpp", + "waveform/widgets/rgbwaveformwidget.cpp", + "waveform/widgets/qtwaveformwidget.cpp", + "waveform/widgets/qtsimplewaveformwidget.cpp", + "waveform/widgets/glwaveformwidget.cpp", + "waveform/widgets/glsimplewaveformwidget.cpp", + "waveform/widgets/glvsynctestwidget.cpp", + + "waveform/widgets/glslwaveformwidget.cpp", + + "waveform/widgets/glrgbwaveformwidget.cpp", + + "skin/imginvert.cpp", + "skin/imgloader.cpp", + "skin/imgcolor.cpp", + "skin/skinloader.cpp", + "skin/legacyskinparser.cpp", + "skin/colorschemeparser.cpp", + "skin/tooltips.cpp", + "skin/skincontext.cpp", + "skin/svgparser.cpp", + "skin/pixmapsource.cpp", + "skin/launchimage.cpp", + + "track/beatfactory.cpp", + "track/beatgrid.cpp", + "track/beatmap.cpp", + "track/beatutils.cpp", + "track/bpm.cpp", + "track/keyfactory.cpp", + "track/keys.cpp", + "track/keyutils.cpp", + "track/playcounter.cpp", + "track/replaygain.cpp", + "track/track.cpp", + "track/trackmetadata.cpp", + "track/trackmetadatataglib.cpp", + "track/tracknumbers.cpp", + + "mixer/auxiliary.cpp", + "mixer/baseplayer.cpp", + "mixer/basetrackplayer.cpp", + "mixer/deck.cpp", + "mixer/microphone.cpp", + "mixer/playerinfo.cpp", + "mixer/playermanager.cpp", + "mixer/previewdeck.cpp", + "mixer/sampler.cpp", + "mixer/samplerbank.cpp", + + "soundio/sounddevice.cpp", + "soundio/sounddevicenetwork.cpp", + "engine/sidechain/enginenetworkstream.cpp", + "soundio/soundmanager.cpp", + "soundio/soundmanagerconfig.cpp", + "soundio/soundmanagerutil.cpp", + + "encoder/encoder.cpp", + "encoder/encodermp3.cpp", + "encoder/encodervorbis.cpp", + + "util/sleepableqthread.cpp", + "util/statsmanager.cpp", + "util/stat.cpp", + "util/statmodel.cpp", + "util/duration.cpp", + "util/time.cpp", + "util/timer.cpp", + "util/performancetimer.cpp", + "util/threadcputimer.cpp", + "util/version.cpp", + "util/rlimit.cpp", + "util/battery/battery.cpp", + "util/valuetransformer.cpp", + "util/sandbox.cpp", + "util/file.cpp", + "util/mac.cpp", + "util/task.cpp", + "util/experiment.cpp", + "util/xml.cpp", + "util/tapfilter.cpp", + "util/movinginterquartilemean.cpp", + "util/console.cpp", + "util/db/dbconnection.cpp", + "util/db/dbid.cpp", + "util/db/fwdsqlquery.cpp", + "util/db/fwdsqlqueryselectresult.cpp", + "util/db/sqllikewildcardescaper.cpp", + "util/db/sqlqueryfinisher.cpp", + "util/db/sqlstringformatter.cpp", + "util/db/sqltransaction.cpp", + "util/sample.cpp", + "util/samplebuffer.cpp", + "util/singularsamplebuffer.cpp", + "util/circularsamplebuffer.cpp", + "util/rotary.cpp", + "util/logging.cpp", + "util/cmdlineargs.cpp", + "util/audiosignal.cpp", + "util/autohidpi.cpp", + "util/screensaver.cpp", + + '#res/mixxx.qrc' ] proto_args = { diff --git a/src/preferences/dialog/dlgprefcontrolsdlg.ui b/src/preferences/dialog/dlgprefcontrolsdlg.ui index 750c5abd0d56..ca6afebe4259 100644 --- a/src/preferences/dialog/dlgprefcontrolsdlg.ui +++ b/src/preferences/dialog/dlgprefcontrolsdlg.ui @@ -14,7 +14,355 @@ Interface Preferences - + + + + Skin options + + + + + + true + + + + + + Skin + + + false + + + ComboBoxSkinconf + + + + + + + + 0 + 0 + + + + + + + + + + + + + + Qt::AlignJustify|Qt::AlignVCenter + + + + + + + true + + + + + + Color scheme + + + false + + + ComboBoxSchemeconf + + + + + + + + 0 + 0 + + + + + + + Select from different color schemes of a skin if available. + + + + + + + Locale + + + ComboBoxLocale + + + + + + + Locales determine country and language specific settings. + + + + + + + Full-screen mode + + + checkBoxStartFullScreen + + + + + + + Start in full-screen mode + + + + + + + true + + + + + + Tool tips + + + false + + + radioButtonTooltipsOff + + + + + + + + + Off + + + buttonGroupTooltips + + + + + + + Library only + + + buttonGroupTooltips + + + + + + + Library and Skin + + + buttonGroupTooltips + + + + + + + + + HiDPI / Retina scaling + + + checkBoxScaleFactorAuto + + + + + + + Change the size of text, buttons, and other items. + + + + + + + Adopt scale factor from the Os + + + Auto Scaling + + + + + + + Screen saver + + + + + + + + + + + + + Deck options + + + + + + Cue mode + + + true + + + ComboBoxCueDefault + + + + + + + Mixxx mode: +- Cue button while pause at cue point = preview +- Cue button while pause not at cue point = set cue point +- Cue button while playing = pause at cue point +Mixxx mode (no blinking): +- Same as Mixxx mode but with no blinking indicators +Pioneer mode: +- Same as Mixxx mode with a flashing play button +Denon mode: +- Cue button at cue point = preview +- Cue button not at cue point = pause at cue point +- Play = set cue point +Numark mode: +- Same as Denon mode, but without a flashing play button +CUP mode: +- Cue button while pause at cue point = play after release +- Cue button while pause not at cue point = set cue point and play after release +- Cue button while playing = go to cue point and play after release + + + + + + + + true + + + + + + Track time display + + + false + + + radioButtonElapsed + + + + + + + + + Elapsed + + + buttonGroupTrackTime + + + + + + + Remaining + + + buttonGroupTrackTime + + + + + + + Elapsed and Remaining + + + buttonGroupTrackTime + + + + + + + + + Auto cue + + + checkBoxSeekToCue + + + + + + + Automatically seeks to the first saved cue point on track load. + If none exists, seeks to the beginning of the track. + + + Jump to main cue point on track load + + + + + + + Playing track protection + + + checkBoxDisallowLoadToPlayingDeck + + + + + + + Do not load tracks into playing decks + + + + + + + Speed (Tempo) and Key (Pitch) options @@ -210,580 +558,242 @@ - - - - false - - - Ramping sensitivity - - - SliderRateRampSensitivity - - - - - - - Pitch bend behavior - - - radioButtonSpeedBendStatic - - - - - - - Original key - - - buttonGroupKeyLockMode - - - - - - - false - - - Temporary rate change when left-clicking - - - true - - - % - - - 2 - - - 0.010000000000000 - - - 10.000000000000000 - - - 0.010000000000000 - - - 4.000000000000000 - - - - - - - Speed/Tempo - - - buttonGroupSpeedPitchReset - - - - - - - Key/Pitch - - - buttonGroupSpeedPitchReset - - - - - - - Adjustment buttons: - - - - - - - true - - - - - - - - - Coarse - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - spinBoxPermRateLeft - - - - - - - true - - - - - - - - - Fine - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - spinBoxPermRateRight - - - - - - - Make the speed sliders work like those on DJ turntables and CDJs where moving downward increases the speed - - - Down increases speed - - - - - + + - true - - - + false - Slider range - - - false + Ramping sensitivity - ComboBoxRateRange + SliderRateRampSensitivity - - - - + + + + Pitch bend behavior - - Adjusts the range of the speed (Vinyl "Pitch") slider. + + radioButtonSpeedBendStatic - - + + - Abrupt jump + Original key - buttonGroupSpeedBendBehavior + buttonGroupKeyLockMode - - + + + + false + - Smoothly adjusts deck speed when temporary change buttons are held down + Temporary rate change when left-clicking - - Smooth ramping + + true + + + % + + + 2 + + + 0.010000000000000 + + + 10.000000000000000 + + + 0.010000000000000 + + + 4.000000000000000 - - buttonGroupSpeedBendBehavior - - - + + - Keyunlock mode + Speed/Tempo + + buttonGroupSpeedPitchReset + - - + + - Reset key + Key/Pitch - buttonGroupKeyUnlockMode + buttonGroupSpeedPitchReset - - + + - Keep key + Adjustment buttons: - - buttonGroupKeyUnlockMode - - - - - - - - - - Skin options - - - - - - - 0 - 0 - - - - - - - Select from different color schemes of a skin if available. - - - - - - - Locale - - - ComboBoxLocale - - - - - - - - 0 - 0 - - - - - - - - - - - true - - - - - - Skin - - - false - - - ComboBoxSkinconf - - - - - - - true - - - - - - Color scheme - - - false - - - ComboBoxSchemeconf - - - - - - - true - - - - - - Tool tips - - - false - - - radioButtonTooltipsOff - - - - - - - Start in full-screen mode - - - - - - - Locales determine country and language specific settings. - - - - - - - Full-screen mode - - - checkBoxStartFullScreen - - - - - - - HiDPI / Retina scaling - - - checkBoxScaleFactorAuto - - - - - - - + + + + true + + + + + + + + + Coarse + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + spinBoxPermRateLeft + + + + + + + true + + + + + + + - Off + Fine + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + spinBoxPermRateRight - - buttonGroupTooltips - - - + + + + Make the speed sliders work like those on DJ turntables and CDJs where moving downward increases the speed + - Library only + Down increases speed - - buttonGroupTooltips - - - + + + + true + + + + - Library and Skin + Slider range + + + false + + + ComboBoxRateRange + + + + + + + + + + Adjusts the range of the speed (Vinyl "Pitch") slider. + + + + + + + Abrupt jump - buttonGroupTooltips + buttonGroupSpeedBendBehavior - - - - - - Adopt scale factor from the Os - - - Auto Scaling - - - - - - - Change the size of text, buttons, and other items. - - - - - - - Screen saver - - - - - - - - - - - - - Deck options - - - - - - Cue mode - - - true - - - ComboBoxCueDefault - - - - - - - Mixxx mode: -- Cue button while pause at cue point = preview -- Cue button while pause not at cue point = set cue point -- Cue button while playing = pause at cue point -Mixxx mode (no blinking): -- Same as Mixxx mode but with no blinking indicators -Pioneer mode: -- Same as Mixxx mode with a flashing play button -Denon mode: -- Cue button at cue point = preview -- Cue button not at cue point = pause at cue point -- Play = set cue point -Numark mode: -- Same as Denon mode, but without a flashing play button -CUP mode: -- Cue button while pause at cue point = play after release -- Cue button while pause not at cue point = set cue point and play after release -- Cue button while playing = go to cue point and play after release - - - - - - - - true - - - - - - Track time display - - - false - - - radioButtonElapsed - - - - - - - + + + + Smoothly adjusts deck speed when temporary change buttons are held down + - Elapsed + Smooth ramping - buttonGroupTrackTime + buttonGroupSpeedBendBehavior - - + + - Remaining + Keyunlock mode + + + + + + + Reset key - buttonGroupTrackTime + buttonGroupKeyUnlockMode - - + + - Elapsed and Remaining + Keep key - buttonGroupTrackTime + buttonGroupKeyUnlockMode - - - - Auto cue - - - checkBoxSeekToCue - - - - - - - Automatically seeks to the first saved cue point on track load. - If none exists, seeks to the beginning of the track. - - - Jump to main cue point on track load - - - - - - - Playing track protection - - - checkBoxDisallowLoadToPlayingDeck - - - - - - - Do not load tracks into playing decks - - - - + Qt::Vertical @@ -962,15 +972,15 @@ CUP mode: - - + + false + - From 7133d1c29485e293e4cb81f7f0e640a729fbd608 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Fri, 31 Mar 2017 21:15:38 +0200 Subject: [PATCH 12/14] fix order of loading setting. caused it to not be correct in the settings dialog --- src/mixxx.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 33dd68fc2210..9237b9688a7c 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -306,6 +306,17 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { connect(this, SIGNAL(newSkinLoaded()), m_pLibrary, SLOT(onSkinLoadFinished())); + // Inhibit the screensaver if the option is set. (Do it before creating the preferences dialog) + int inhibit = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver"),-1); + if (inhibit == -1) { + inhibit = static_cast(mixxx::ScreenSaverPreference::PREVENT_ON); + pConfig->setValue(ConfigKey("[Config]","InhibitScreensaver"), inhibit); + } + m_inhibitScreensaver = static_cast(inhibit); + if (m_inhibitScreensaver == mixxx::ScreenSaverPreference::PREVENT_ON) { + mixxx::ScreenSaverHelper::inhibit(); + } + // Initialize preference dialog m_pPrefDlg = new DlgPreferences(this, m_pSkinLoader, m_pSoundManager, m_pPlayerManager, m_pControllerManager, m_pVCManager, m_pEffectsManager, @@ -370,17 +381,6 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { } emit(newSkinLoaded()); - // Inhibit the screensaver if the option is set. - int inhibit = pConfig->getValue(ConfigKey("[Config]","InhibitScreensaver"),-1); - if (inhibit == -1) { - inhibit = static_cast(mixxx::ScreenSaverPreference::PREVENT_ON); - pConfig->setValue(ConfigKey("[Config]","InhibitScreensaver"), inhibit); - } - m_inhibitScreensaver = static_cast(inhibit); - if (m_inhibitScreensaver == mixxx::ScreenSaverPreference::PREVENT_ON) { - mixxx::ScreenSaverHelper::inhibit(); - } - // Wait until all other ControlObjects are set up before initializing // controllers From 72f7c37966971fadf494a555117567853985d0f6 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Thu, 6 Apr 2017 23:52:13 +0200 Subject: [PATCH 13/14] fix for linux screensaver user activity and fallback method using xlib --- src/util/screensaver.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index 719ae9fbfaab..0ca973d6ea03 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -26,14 +26,16 @@ With the help of the following source codes: #elif defined(Q_OS_LINUX) # include #elif HAVE_XSCREENSAVER_SUSPEND +# include +#endif // Q_OS_WIN + +#if defined(Q_OS_LINUX) || HAVE_XSCREENSAVER_SUSPEND # define None XNone # define Window XWindow # include # undef None # undef Window -# include -#endif // Q_OS_WIN - +#endif namespace mixxx { @@ -148,11 +150,11 @@ const char *SCREENSAVERS[][4] = { {nullptr, nullptr, nullptr, nullptr} }; const char *USERACTIVITY[][4] = { - // org.freedesktop.ScreenSaver is the standard. should work for gnome and kde too, - // but I add their specific names too - {"org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity"}, + // "SimulateUserActivity" is not widely supported, but we can try that first. + {"org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity" }, {"org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity"}, {"org.kde.screensaver", "/ScreenSaver", "org.kde.screensaver", "SimulateUserActivity"}, + {"org.cinnamon.ScreenSaver", "/ScreenSaver", "org.cinnamon.ScreenSaver", "SimulateUserActivity"}, {nullptr, nullptr, nullptr, nullptr} }; @@ -163,6 +165,14 @@ bool ScreenSaverHelper::s_sendActivity = true; void ScreenSaverHelper::triggerUserActivity() { if (!s_sendActivity) { + // If the D-Bus method didn't work, let's try the Xlib method. + const char* name = ":0.0"; + Display *display; + if (getenv("DISPLAY")) + name=getenv("DISPLAY"); + display=XOpenDisplay(name); + XResetScreenSaver(display); + XCloseDisplay(display); return; } @@ -173,23 +183,25 @@ void ScreenSaverHelper::triggerUserActivity() return; } s_sendActivity = false; + QString errors; for (int i=0; USERACTIVITY[i][0] != nullptr; i++ ) { QDBusInterface iface(USERACTIVITY[i][0], USERACTIVITY[i][1], USERACTIVITY[i][2], QDBusConnection::sessionBus()); if (iface.isValid()) { - QDBusReply reply = iface.call(USERACTIVITY[i][3]); + QDBusReply reply = iface.call(USERACTIVITY[i][3]); if (reply.isValid()) { s_sendActivity = true; break; } else { - qWarning() << "Call to inhibit for " << USERACTIVITY[i][0] << " failed: " - << reply.error().message(); + errors = errors + "\nCall to inhibit for " + USERACTIVITY[i][0] + " failed: " + + reply.error().message(); } } } if (!s_sendActivity) { qWarning() << "Could not send activity using the registered DBus methods. " - << "Will not try again until the program is restarted. "; + << "Errors were: " << errors << + "\nWill try to use the Xlib XResetScreensaver instead."; } } void ScreenSaverHelper::inhibitInternal() From 305e6978b3c4bb6188eb3cd4db10301e71c5d343 Mon Sep 17 00:00:00 2001 From: JosepMaJAZ Date: Sat, 8 Apr 2017 12:14:13 +0200 Subject: [PATCH 14/14] use only xlib methodfor useractivity --- src/util/screensaver.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/util/screensaver.cpp b/src/util/screensaver.cpp index 0ca973d6ea03..e7d9e7485935 100644 --- a/src/util/screensaver.cpp +++ b/src/util/screensaver.cpp @@ -149,19 +149,35 @@ const char *SCREENSAVERS[][4] = { {"org.kde.screensaver", "/ScreenSaver", "org.kde.screensaver", "Inhibit"}, {nullptr, nullptr, nullptr, nullptr} }; +// Disabling the method with DBus since it seems to be failing on several systems. +#if 0 const char *USERACTIVITY[][4] = { // "SimulateUserActivity" is not widely supported, but we can try that first. {"org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity" }, + {"org.cinnamon.ScreenSaver", "/ScreenSaver", "org.cinnamon.ScreenSaver", "SimulateUserActivity"}, {"org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity"}, {"org.kde.screensaver", "/ScreenSaver", "org.kde.screensaver", "SimulateUserActivity"}, - {"org.cinnamon.ScreenSaver", "/ScreenSaver", "org.cinnamon.ScreenSaver", "SimulateUserActivity"}, {nullptr, nullptr, nullptr, nullptr} }; +#endif // 0 uint32_t ScreenSaverHelper::s_cookie = 0; int ScreenSaverHelper::s_saverindex = -1; bool ScreenSaverHelper::s_sendActivity = true; +void ScreenSaverHelper::triggerUserActivity() +{ + const char* name = ":0.0"; + Display *display; + if (getenv("DISPLAY")) + name=getenv("DISPLAY"); + display=XOpenDisplay(name); + XResetScreenSaver(display); + XCloseDisplay(display); + return; +} +// Disabling the method with DBus since it seems to be failing on several systems. +#if 0 void ScreenSaverHelper::triggerUserActivity() { if (!s_sendActivity) { @@ -204,6 +220,8 @@ void ScreenSaverHelper::triggerUserActivity() "\nWill try to use the Xlib XResetScreensaver instead."; } } +#endif // 0 + void ScreenSaverHelper::inhibitInternal() { if (!QDBusConnection::sessionBus().isConnected()) {