All pastes #896782 Raw Edit

Untitled

public text v1 · immutable
·published 2008-02-08 23:12 UTC
rendered paste body
diff -u generic-prepatch/generic_monitor.cpp generic/generic_monitor.cpp
--- generic-prepatch/generic_monitor.cpp        2007-06-04 21:59:02.000000000 -0400
+++ generic/generic_monitor.cpp 2007-06-04 22:06:37.000000000 -0400
@@ -47,8 +49,6 @@

        m_mute = false;
        m_progress = 0;
-       m_minVolume = 0;
-       m_maxVolume = 100;
        m_volume = 50;
 }
@@ -92,7 +109,7 @@
 {
        bool kmix_error = false;

-       DCOPReply reply = kmixClient->call("absoluteVolume", 0);
+       DCOPReply reply = kmixClient->call("masterVolume");
        if (reply.isValid())
                m_volume = reply;
        else
@@ -104,7 +121,7 @@
                if (kapp->startServiceByDesktopName("kmix")==0) // trying to start kmix
                {
                        // trying again
-                       reply = kmixClient->call("absoluteVolume", 0);
+                       reply = kmixClient->call("masterVolume");
                        if (reply.isValid())
                        {
                                m_volume = reply;
@@ -122,10 +139,6 @@

                return false;
        } else {
-               reply = kmixClient->call("absoluteVolumeMax", 0);
-               m_maxVolume = reply;
-               reply = kmixClient->call("absoluteVolumeMin", 0);
-               m_minVolume = reply;
                return true;
        }
 }
@@ -135,9 +148,9 @@
        if (!retrieveVolume())
                return;

-       m_volume += (int)((m_maxVolume - m_minVolume) * step /100) +1;
-       if (m_volume > m_maxVolume)
-               m_volume = m_maxVolume;
+       m_volume += step;
+       if (m_volume > 100)
+               m_volume = 100;

        displayVolume();
 }
@@ -147,9 +160,9 @@
        if (!retrieveVolume())
                return;

-       m_volume -= (int)((m_maxVolume - m_minVolume) * step /100) +1;
-       if (m_volume < m_minVolume)
-               m_volume = m_minVolume;
+       m_volume -= step;
+       if (m_volume < 0)
+               m_volume = 0;

        displayVolume();
 }
@@ -161,11 +174,11 @@

 void GenericMonitor::displayVolume()
 {
-       _interface->displayProgress(i18n("Volume"), (int)(m_volume * 100 / (m_maxVolume - m_minVolume)));
+       _interface->displayProgress(i18n("Volume"), m_volume);

        // If we got this far, the DCOP communication with kmix works,
        // so we don't have to test the result.
-       kmixClient->send("setAbsoluteVolume", 0, m_volume);
+       kmixClient->send("setMasterVolume", m_volume);

        // if mute then unmute
        if (m_mute)
diff -u generic-prepatch/generic_monitor.h generic/generic_monitor.h
--- generic-prepatch/generic_monitor.h  2007-06-04 21:59:02.000000000 -0400
+++ generic/generic_monitor.h   2007-06-04 22:01:39.000000000 -0400
@@ -69,17 +83,17 @@
        DCOPRef *kmixClient, *kmixWindow;

        int m_progress;
-       long m_volume, m_oldVolume;
+       int m_volume, m_oldVolume;
        bool m_mute;

-       long m_maxVolume, m_minVolume;
-
        Monitor::DisplayType m_displayType;
 };