Improved: Switched to stricter code formatter (Uncrustify) for better consistency across all source files.

This commit is contained in:
jthedering committed 2015-11-23 21:17:34 +00:00
1 parent a1be4cc70f
commit 57e8158efd
202 files changed
+4595 -4284

No files matched your search

+42 -42
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.h"
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
{
stringstream versionStream;
versionStream << MAJOR << "." << MINOR;
if(REVISION != 0)
if (REVISION != 0)
versionStream << "." << REVISION;
TCLAP::CmdLine cmd("Benchmark generates a linear sine sweep or reads from the given input file. "
"It then filters the waveform using the Equalizer APO filter configuration "
@@ -71,8 +71,8 @@ int main(int argc, char** argv)
bool verbose = verboseArg.getValue();
LogHelper::set(stderr, verbose, true, true);
#ifdef _DEBUG
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
//_CrtSetBreakAlloc(3318);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
// _CrtSetBreakAlloc(3318);
#endif
unsigned sampleRate;
@@ -82,7 +82,7 @@ int main(int argc, char** argv)
float length;
float* buf;
if(REVISION == 0)
if (REVISION == 0)
printf("Benchmark %d.%d\n", MAJOR, MINOR);
else
printf("Benchmark %d.%d.%d\n", MAJOR, MINOR, REVISION);
@@ -91,7 +91,7 @@ int main(int argc, char** argv)
printf("\n");
string input = inputArg.getValue();
if(input != "")
if (input != "")
{
printf("Reading sound data from %s\n", input.c_str());
@@ -100,7 +100,7 @@ int main(int argc, char** argv)
SF_INFO info;
SNDFILE* inFile = sf_open(input.c_str(), SFM_READ, &info);
if(inFile == NULL)
if (inFile == NULL)
{
fprintf(stderr, "%s", sf_strerror(inFile));
return 1;
@@ -115,7 +115,7 @@ int main(int argc, char** argv)
buf = new float[frameCount * channelCount];
sf_count_t numRead = 0;
while(numRead < frameCount)
while (numRead < frameCount)
numRead += sf_readf_float(inFile, buf + numRead * channelCount, frameCount - numRead);
sf_close(inFile);
@@ -141,13 +141,13 @@ int main(int argc, char** argv)
timer.start();
buf = new float[frameCount * channelCount];
for(unsigned i=0; i<frameCount; i++)
for (unsigned i = 0; i < frameCount; i++)
{
double t=i*1.0 / sampleRate;
float s = (float)sin(((sweepFrom + sweepDiff*(t/length)/2)*t)*2*M_PI);
double t = i * 1.0 / sampleRate;
float s = (float)sin(((sweepFrom + sweepDiff * (t / length) / 2) * t) * 2 * M_PI);
for(unsigned j=0; j<channelCount; j++)
buf[i*channelCount + j] = s;
for (unsigned j = 0; j < channelCount; j++)
buf[i * channelCount + j] = s;
}
double genTime = timer.stop();
@@ -157,8 +157,8 @@ int main(int argc, char** argv)
unsigned batchsize = batchsizeArg.getValue();
float* buf2 = new float[frameCount * channelCount];
for(unsigned i=0;i<frameCount*channelCount;i++)
buf2[i]=0.0f;
for (unsigned i = 0; i < frameCount * channelCount; i++)
buf2[i] = 0.0f;
PrecisionTimer timer;
timer.start();
@@ -170,16 +170,16 @@ int main(int argc, char** argv)
engine.initialize((float)sampleRate, channelCount, channelCount, channelCount, channelMask, batchsize);
double initTime = timer.stop();
if(!verbose)
if (!verbose)
printf("\nLoading configuration took %g ms\n", initTime * 1000.0);
printf("\nProcessing %d frames from %d channel(s)\n", frameCount, channelCount);
timer.start();
for(unsigned i=0; i<frameCount; i+=batchsize)
for (unsigned i = 0; i < frameCount; i += batchsize)
{
engine.process(buf2 + i*channelCount, buf + i*channelCount, min(batchsize, frameCount - i));
engine.process(buf2 + i * channelCount, buf + i * channelCount, min(batchsize, frameCount - i));
}
double time = timer.stop();
@@ -189,25 +189,25 @@ int main(int argc, char** argv)
unsigned clipCount = 0;
float max = 0;
for(unsigned i=0; i<frameCount*channelCount; i++)
for (unsigned i = 0; i < frameCount * channelCount; i++)
{
float f = fabs(buf2[i]);
if(f > max)
if (f > max)
max = f;
if(f > 1.0f)
if (f > 1.0f)
clipCount++;
}
printf("Max output level: %f (%f dB)", max, log10(max) * 20.0f);
if(clipCount > 0)
if (clipCount > 0)
printf(" (%d samples clipped!)", clipCount);
printf("\n");
string output = outputArg.getValue();
if(output == "")
if (output == "")
{
char temp[255];
GetTempPathA(sizeof(temp)/sizeof(wchar_t), temp);
GetTempPathA(sizeof(temp) / sizeof(wchar_t), temp);
output = temp;
output += "testout.wav";
@@ -217,28 +217,28 @@ int main(int argc, char** argv)
SF_INFO info = {frameCount, (int)sampleRate, (int)channelCount, SF_FORMAT_WAV | SF_FORMAT_PCM_16, 0};
SNDFILE* outFile = sf_open(output.c_str(), SFM_WRITE, &info);
if(outFile == NULL)
if (outFile == NULL)
{
fprintf(stderr, "%s", sf_strerror(outFile));
return 1;
}
sf_count_t numWritten = 0;
while(numWritten < frameCount)
while (numWritten < frameCount)
numWritten += sf_writef_float(outFile, buf2 + numWritten * channelCount, frameCount - numWritten);
sf_close(outFile);
outFile = NULL;
delete[] buf;
delete[] buf2;
delete[]buf;
delete[]buf2;
if(!noPauseArg.getValue())
if (!noPauseArg.getValue())
system("pause");
return 0;
}
catch(TCLAP::ArgException e)
catch (TCLAP::ArgException e)
{
printf("Error: %s for arg %s\n", e.error().c_str(), e.argId().c_str());
return -1;
+18 -18
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.h"
@@ -31,7 +31,7 @@ ClassFactory::ClassFactory()
HRESULT __stdcall ClassFactory::QueryInterface(const IID& iid, void** ppv)
{
if(iid == __uuidof(IUnknown) || iid == __uuidof(IClassFactory))
if (iid == __uuidof(IUnknown) || iid == __uuidof(IClassFactory))
*ppv = static_cast<IClassFactory*>(this);
else
{
@@ -50,7 +50,7 @@ ULONG __stdcall ClassFactory::AddRef()
ULONG __stdcall ClassFactory::Release()
{
if(InterlockedDecrement(&refCount) == 0)
if (InterlockedDecrement(&refCount) == 0)
{
delete this;
return 0;
@@ -61,11 +61,11 @@ ULONG __stdcall ClassFactory::Release()
HRESULT __stdcall ClassFactory::CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv)
{
if(pUnknownOuter != NULL && iid != __uuidof(IUnknown))
if (pUnknownOuter != NULL && iid != __uuidof(IUnknown))
return E_NOINTERFACE;
EqualizerAPO* apo = new EqualizerAPO(pUnknownOuter);
if(apo == NULL)
if (apo == NULL)
return E_OUTOFMEMORY;
HRESULT hr = apo->NonDelegatingQueryInterface(iid, ppv);
@@ -76,7 +76,7 @@ HRESULT __stdcall ClassFactory::CreateInstance(IUnknown* pUnknownOuter, const II
HRESULT __stdcall ClassFactory::LockServer(BOOL bLock)
{
if(bLock)
if (bLock)
InterlockedIncrement(&lockCount);
else
InterlockedDecrement(&lockCount);
+14 -14
View File
@@ -1,27 +1,27 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include <Unknwn.h>
class ClassFactory: public IClassFactory
class ClassFactory : public IClassFactory
{
public:
ClassFactory();
+120 -120
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.h"
@@ -32,7 +32,7 @@ using namespace std;
Configurator* configurator;
Configurator::Configurator(HINSTANCE hInstance, const wchar_t* cmdLine)
:cmdLine(cmdLine)
: cmdLine(cmdLine)
{
this->hInstance = hInstance;
hDlg = NULL;
@@ -67,56 +67,56 @@ void Configurator::onInitDialog(HWND hDlg)
tci.pszText = stringBuf;
tci.mask = TCIF_TEXT;
LoadStringW(hInstance, IDS_PLAYBACK_DEVICES, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_PLAYBACK_DEVICES, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
TabCtrl_InsertItem(categoryTabCtrl, 0, &tci);
LoadStringW(hInstance, IDS_CAPTURE_DEVICES, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_CAPTURE_DEVICES, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
TabCtrl_InsertItem(categoryTabCtrl, 1, &tci);
LoadStringW(hInstance, IDS_REQUEST, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_REQUEST, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(requestLabel, stringBuf);
LoadStringW(hInstance, IDS_COPY_DEVICE_COMMAND, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_COPY_DEVICE_COMMAND, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(copyDeviceCommandButton, stringBuf);
LoadStringW(hInstance, IDS_OK, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_OK, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(okButton, stringBuf);
LoadStringW(hInstance, IDS_CANCEL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_CANCEL, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(cancelButton, stringBuf);
LoadStringW(hInstance, IDS_TOGGLE_TROUBLESHOOTING, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_TOGGLE_TROUBLESHOOTING, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(toggleTroubleShooting, stringBuf);
int width = 185;
if(wcsncmp(stringBuf, L"Probleml", 8) == 0)
if (wcsncmp(stringBuf, L"Probleml", 8) == 0)
width = 215;
RECT rect = {0, 0, width, 10};
MapDialogRect(hDlg, &rect);
SetWindowPos(toggleTroubleShooting, NULL, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
SetWindowPos(toggleTroubleShooting, NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
LoadStringW(hInstance, IDS_PRE_MIX_LABEL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_PRE_MIX_LABEL, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(preMixLabel, stringBuf);
LoadStringW(hInstance, IDS_POST_MIX_LABEL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_POST_MIX_LABEL, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(postMixLabel, stringBuf);
LoadStringW(hInstance, IDS_INSTALL_APO, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_INSTALL_APO, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(installPreMix, stringBuf);
SetWindowTextW(installPostMix, stringBuf);
LoadStringW(hInstance, IDS_USE_ORIGINAL_APO, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_USE_ORIGINAL_APO, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(useOriginalAPOPreMix, stringBuf);
SetWindowTextW(useOriginalAPOPostMix, stringBuf);
LoadStringW(hInstance, IDS_INSTALL_MODE_LFX_GFX, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_INSTALL_MODE_LFX_GFX, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
ComboBox_AddString(installModeComboBox, stringBuf);
if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
{
LoadStringW(hInstance, IDS_INSTALL_MODE_SFX_MFX, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_INSTALL_MODE_SFX_MFX, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
ComboBox_AddString(installModeComboBox, stringBuf);
LoadStringW(hInstance, IDS_INSTALL_MODE_SFX_EFX, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_INSTALL_MODE_SFX_EFX, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
ComboBox_AddString(installModeComboBox, stringBuf);
}
ComboBox_SetCurSel(installModeComboBox, 0);
@@ -124,7 +124,7 @@ void Configurator::onInitDialog(HWND hDlg)
LoadStringW(hInstance, IDS_SELECT_ONE_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
SetWindowTextW(selectOneDeviceLabel, stringBuf);
for(int i=0; i<=1; i++)
for (int i = 0; i <= 1; i++)
{
HWND deviceList = deviceLists[i];
ListView_SetExtendedListViewStyle(deviceList, ListView_GetExtendedListViewStyle(deviceList) | LVS_EX_CHECKBOXES);
@@ -132,13 +132,13 @@ void Configurator::onInitDialog(HWND hDlg)
column.pszText = stringBuf;
column.mask = LVCF_TEXT;
LoadStringW(hInstance, IDS_CONNECTOR, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_CONNECTOR, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
ListView_InsertColumn(deviceList, 0, &column);
LoadStringW(hInstance, IDS_DEVICE, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
ListView_InsertColumn(deviceList, 1, &column);
LoadStringW(hInstance, IDS_STATUS, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_STATUS, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
ListView_InsertColumn(deviceList, 2, &column);
LVITEM item;
@@ -148,42 +148,42 @@ void Configurator::onInitDialog(HWND hDlg)
try
{
apoInfos[i] = DeviceAPOInfo::loadAllInfos(i==1);
wstring defaultDevice = StringHelper::toLowerCase(DeviceAPOInfo::getDefaultDevice(i==1));
apoInfos[i] = DeviceAPOInfo::loadAllInfos(i == 1);
wstring defaultDevice = StringHelper::toLowerCase(DeviceAPOInfo::getDefaultDevice(i == 1));
int itemCount=0;
for(vector<DeviceAPOInfo>::iterator it = apoInfos[i].begin(); it != apoInfos[i].end(); it++)
int itemCount = 0;
for (vector<DeviceAPOInfo>::iterator it = apoInfos[i].begin(); it != apoInfos[i].end(); it++)
{
wcsncpy_s(stringBuf, sizeof(stringBuf)/sizeof(wchar_t), it->connectionName.c_str(), _TRUNCATE);
wcsncpy_s(stringBuf, sizeof(stringBuf) / sizeof(wchar_t), it->connectionName.c_str(), _TRUNCATE);
item.iItem = itemCount;
item.lParam = itemCount;
ListView_InsertItem(deviceList, &item);
wcsncpy_s(stringBuf, sizeof(stringBuf)/sizeof(wchar_t), it->deviceName.c_str(), _TRUNCATE);
wcsncpy_s(stringBuf, sizeof(stringBuf) / sizeof(wchar_t), it->deviceName.c_str(), _TRUNCATE);
ListView_SetItemText(deviceList, itemCount, 1, stringBuf);
if(it->isInstalled)
if (it->isInstalled)
{
ListView_SetCheckState(deviceList, itemCount, TRUE);
if(it->canBeUpgraded())
if (it->canBeUpgraded())
LoadStringW(hInstance, IDS_WILL_BE_UPGRADED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else if(it->isEnhancementsDisabled)
else if (it->isEnhancementsDisabled)
LoadStringW(hInstance, IDS_ENHANCEMENTS_WILL_BE_ENABLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else
LoadStringW(hInstance, IDS_ALREADY_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_ALREADY_INSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
}
else if(it->isExperimental())
else if (it->isExperimental())
{
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED_EXPERIMENTAL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED_EXPERIMENTAL, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
}
else
{
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
}
if(it->isDefaultDevice)
if (it->isDefaultDevice)
{
wstring statusText = stringBuf;
LoadStringW(hInstance, IDS_DEFAULT_DEVICE, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_DEFAULT_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
statusText = wstring(stringBuf) + L", " + statusText;
ListView_SetItemText(deviceList, itemCount, 2, const_cast<wchar_t*>(statusText.c_str()));
@@ -196,7 +196,7 @@ void Configurator::onInitDialog(HWND hDlg)
itemCount++;
}
}
catch(RegistryException e)
catch (RegistryException e)
{
MessageBoxW(hDlg, e.getMessage().c_str(), L"Error while accessing the registry", MB_ICONERROR | MB_OK);
}
@@ -226,15 +226,15 @@ void Configurator::onLvnItemChanged(unsigned sourceId, LPNMLISTVIEW info)
bool Configurator::onButtonClicked(unsigned sourceId)
{
switch(sourceId)
switch (sourceId)
{
case IDOK:
{
for(int index = 0; index <= 1; index++)
for (int index = 0; index <= 1; index++)
{
HWND deviceList = deviceLists[index];
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
for (int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
@@ -245,18 +245,18 @@ bool Configurator::onButtonClicked(unsigned sourceId)
try
{
DeviceAPOInfo info = apoInfos[index][item.lParam];
if(ListView_GetCheckState(deviceList, i) && !info.isInstalled)
if (ListView_GetCheckState(deviceList, i) && !info.isInstalled)
info.install();
else if(!ListView_GetCheckState(deviceList, i) && info.isInstalled)
else if (!ListView_GetCheckState(deviceList, i) && info.isInstalled)
info.uninstall();
else if(ListView_GetCheckState(deviceList, i) && (info.canBeUpgraded() || info.hasChanges() || info.isEnhancementsDisabled))
else if (ListView_GetCheckState(deviceList, i) && (info.canBeUpgraded() || info.hasChanges() || info.isEnhancementsDisabled))
{
info.uninstall();
info.load(info.deviceGuid);
info.install();
}
}
catch(RegistryException e)
catch (RegistryException e)
{
MessageBoxW(hDlg, e.getMessage().c_str(), L"Error while accessing the registry", MB_ICONERROR | MB_OK);
}
@@ -272,7 +272,7 @@ bool Configurator::onButtonClicked(unsigned sourceId)
HWND deviceList = deviceLists[index];
bool first = true;
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
for (int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
@@ -281,9 +281,9 @@ bool Configurator::onButtonClicked(unsigned sourceId)
item.stateMask = LVIS_SELECTED;
ListView_GetItem(deviceList, &item);
if(item.state & LVIS_SELECTED)
if (item.state & LVIS_SELECTED)
{
if(first)
if (first)
first = false;
else
command += L"; ";
@@ -321,7 +321,7 @@ bool Configurator::onButtonClicked(unsigned sourceId)
HWND deviceList = deviceLists[index];
unsigned selectedCount = ListView_GetSelectedCount(deviceList);
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
for (int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
@@ -330,11 +330,11 @@ bool Configurator::onButtonClicked(unsigned sourceId)
item.stateMask = LVIS_SELECTED;
ListView_GetItem(deviceList, &item);
if(item.state & LVIS_SELECTED)
if (item.state & LVIS_SELECTED)
{
DeviceAPOInfo& info = apoInfos[index][item.lParam];
switch(sourceId)
switch (sourceId)
{
case IDC_INSTALL_PRE_MIX:
info.selectedInstallState.installPreMix = Button_GetCheck(installPreMix) == BST_CHECKED;
@@ -362,45 +362,45 @@ bool Configurator::onButtonClicked(unsigned sourceId)
break;
}
if(sourceId == IDCANCEL && hasUpgrades())
if (sourceId == IDCANCEL && hasUpgrades())
{
wchar_t captionBuf[255];
LoadStringW(hInstance, IDS_CANCEL_UPGRADES_CAPTION, captionBuf, sizeof(captionBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_CANCEL_UPGRADES_CAPTION, captionBuf, sizeof(captionBuf) / sizeof(wchar_t));
wchar_t stringBuf[255];
LoadStringW(hInstance, IDS_CANCEL_UPGRADES, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
if(MessageBoxW(hDlg, stringBuf, captionBuf, MB_ICONWARNING | MB_YESNO) == IDNO)
LoadStringW(hInstance, IDS_CANCEL_UPGRADES, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
if (MessageBoxW(hDlg, stringBuf, captionBuf, MB_ICONWARNING | MB_YESNO) == IDNO)
return false;
}
if(sourceId == IDOK || sourceId == IDCANCEL)
if (sourceId == IDOK || sourceId == IDCANCEL)
{
if(cmdLine == L"/i")
if (cmdLine == L"/i")
{
wchar_t stringBuf[255];
LoadStringW(hInstance, IDS_AFTERINSTALL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_AFTERINSTALL, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
MessageBoxW(hDlg, stringBuf, L"Info", MB_ICONINFORMATION | MB_OK);
}
else if(sourceId == IDOK && RegistryHelper::isWindowsVersionAtLeast(6, 3) // Windows 8.1
else if (sourceId == IDOK && RegistryHelper::isWindowsVersionAtLeast(6, 3) // Windows 8.1
|| askForReboot)
{
wchar_t captionBuf[255];
LoadStringW(hInstance, IDS_SHOULD_REBOOT_CAPTION, captionBuf, sizeof(captionBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_SHOULD_REBOOT_CAPTION, captionBuf, sizeof(captionBuf) / sizeof(wchar_t));
wchar_t stringBuf[255];
LoadStringW(hInstance, IDS_SHOULD_REBOOT, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
if(MessageBoxW(hDlg, stringBuf, captionBuf, MB_ICONQUESTION | MB_YESNO) == IDYES)
LoadStringW(hInstance, IDS_SHOULD_REBOOT, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
if (MessageBoxW(hDlg, stringBuf, captionBuf, MB_ICONQUESTION | MB_YESNO) == IDYES)
{
HANDLE tokenHandle;
if(OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tokenHandle))
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tokenHandle))
{
LUID luid;
if(LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &luid))
if (LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &luid))
{
TOKEN_PRIVILEGES tp;
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if(AdjustTokenPrivileges(tokenHandle, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL))
if (AdjustTokenPrivileges(tokenHandle, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL))
InitiateShutdownW(NULL, NULL, 0, SHUTDOWN_RESTART | SHUTDOWN_GRACE_OVERRIDE, SHTDN_REASON_MAJOR_APPLICATION | SHTDN_REASON_MINOR_MAINTENANCE);
}
@@ -431,11 +431,11 @@ bool Configurator::isAnySelected()
{
bool anySelected = false;
for(int index = 0; index <= 1; index++)
for (int index = 0; index <= 1; index++)
{
HWND deviceList = deviceLists[index];
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
for (int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
@@ -443,7 +443,7 @@ bool Configurator::isAnySelected()
item.mask = LVIF_PARAM;
ListView_GetItem(deviceList, &item);
DeviceAPOInfo apoInfo = apoInfos[index][item.lParam];
if(ListView_GetCheckState(deviceList, i) != 0)
if (ListView_GetCheckState(deviceList, i) != 0)
{
anySelected = true;
break;
@@ -458,11 +458,11 @@ bool Configurator::isChanged()
{
bool changed = false;
for(int index = 0; index <= 1; index++)
for (int index = 0; index <= 1; index++)
{
HWND deviceList = deviceLists[index];
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
for (int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
@@ -470,7 +470,7 @@ bool Configurator::isChanged()
item.mask = LVIF_PARAM;
ListView_GetItem(deviceList, &item);
DeviceAPOInfo apoInfo = apoInfos[index][item.lParam];
if((ListView_GetCheckState(deviceList, i) != 0) != apoInfo.isInstalled
if ((ListView_GetCheckState(deviceList, i) != 0) != apoInfo.isInstalled
|| ListView_GetCheckState(deviceList, i) && apoInfo.isInstalled && (apoInfo.canBeUpgraded() || apoInfo.hasChanges() || apoInfo.isEnhancementsDisabled))
{
changed = true;
@@ -486,11 +486,11 @@ bool Configurator::hasUpgrades()
{
bool hasUpgrades = false;
for(int index = 0; index <= 1; index++)
for (int index = 0; index <= 1; index++)
{
HWND deviceList = deviceLists[index];
for(int i = 0; i < ListView_GetItemCount(deviceList); i++)
for (int i = 0; i < ListView_GetItemCount(deviceList); i++)
{
LVITEM item;
item.iItem = i;
@@ -498,7 +498,7 @@ bool Configurator::hasUpgrades()
item.mask = LVIF_PARAM;
ListView_GetItem(deviceList, &item);
DeviceAPOInfo apoInfo = apoInfos[index][item.lParam];
if(ListView_GetCheckState(deviceList, i) && apoInfo.isInstalled && (apoInfo.canBeUpgraded() || apoInfo.isEnhancementsDisabled))
if (ListView_GetCheckState(deviceList, i) && apoInfo.isInstalled && (apoInfo.canBeUpgraded() || apoInfo.isEnhancementsDisabled))
{
hasUpgrades = true;
break;
@@ -536,15 +536,15 @@ void Configurator::expandTroubleShooting(bool expand)
WINDOWINFO windowInfo;
GetWindowInfo(hDlg, &windowInfo);
int height = expand ? 250 : 209;
RECT rect={0, 0, 401, height};
RECT rect = {0, 0, 401, height};
MapDialogRect(hDlg, &rect);
AdjustWindowRect(&rect, windowInfo.dwStyle, false);
SetWindowPos(hDlg, NULL, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
SetWindowPos(hDlg, NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
}
HDWP Configurator::moveWindow(HDWP hdwp, HWND hWnd, int x, int y)
{
RECT rect={x, y, 0, 0};
RECT rect = {x, y, 0, 0};
MapDialogRect(hDlg, &rect);
return DeferWindowPos(hdwp, hWnd, NULL, rect.left, rect.top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
}
@@ -555,32 +555,32 @@ void Configurator::updateList(int listIndex, int itemIndex)
int itemCount = ListView_GetItemCount(deviceList);
if(apoInfos[listIndex].size() == itemCount)
if (apoInfos[listIndex].size() == itemCount)
{
DeviceAPOInfo apoInfo = apoInfos[listIndex][itemIndex];
bool checked = ListView_GetCheckState(deviceList, itemIndex) != 0;
wchar_t stringBuf[255];
if(checked && !apoInfo.isInstalled)
LoadStringW(hInstance, IDS_WILL_BE_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(!checked && apoInfo.isInstalled)
LoadStringW(hInstance, IDS_WILL_BE_UNINSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isInstalled && apoInfo.canBeUpgraded())
LoadStringW(hInstance, IDS_WILL_BE_UPGRADED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isInstalled && apoInfo.hasChanges())
LoadStringW(hInstance, IDS_WILL_BE_CHANGED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isInstalled && apoInfo.isEnhancementsDisabled)
if (checked && !apoInfo.isInstalled)
LoadStringW(hInstance, IDS_WILL_BE_INSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else if (!checked && apoInfo.isInstalled)
LoadStringW(hInstance, IDS_WILL_BE_UNINSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else if (apoInfo.isInstalled && apoInfo.canBeUpgraded())
LoadStringW(hInstance, IDS_WILL_BE_UPGRADED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else if (apoInfo.isInstalled && apoInfo.hasChanges())
LoadStringW(hInstance, IDS_WILL_BE_CHANGED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else if (apoInfo.isInstalled && apoInfo.isEnhancementsDisabled)
LoadStringW(hInstance, IDS_ENHANCEMENTS_WILL_BE_ENABLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else if(apoInfo.isInstalled)
LoadStringW(hInstance, IDS_ALREADY_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if(apoInfo.isExperimental())
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED_EXPERIMENTAL, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
else if (apoInfo.isInstalled)
LoadStringW(hInstance, IDS_ALREADY_INSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else if (apoInfo.isExperimental())
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED_EXPERIMENTAL, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
else
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_CAN_BE_INSTALLED, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
if(apoInfo.isDefaultDevice)
if (apoInfo.isDefaultDevice)
{
wstring statusText = stringBuf;
LoadStringW(hInstance, IDS_DEFAULT_DEVICE, stringBuf, sizeof(stringBuf)/sizeof(wchar_t));
LoadStringW(hInstance, IDS_DEFAULT_DEVICE, stringBuf, sizeof(stringBuf) / sizeof(wchar_t));
statusText = wstring(stringBuf) + L", " + statusText;
ListView_SetItemText(deviceList, itemIndex, 2, const_cast<wchar_t*>(statusText.c_str()));
@@ -600,7 +600,7 @@ void Configurator::updateButtons(int listIndex)
wchar_t stringBuf[255];
bool changed = isChanged();
if(changed || !isAnySelected())
if (changed || !isAnySelected())
{
ShowWindow(okButton, SW_SHOW);
EnableWindow(okButton, changed);
@@ -622,10 +622,10 @@ void Configurator::updateButtons(int listIndex)
bool hasOriginalAPOPreMix = true;
bool hasOriginalAPOPostMix = true;
DeviceAPOInfo::InstallState installState;
if(selectedCount == 1)
if (selectedCount == 1)
{
int selectedIndex = ListView_GetNextItem(deviceList, -1, LVNI_SELECTED);
if(selectedIndex != -1)
if (selectedIndex != -1)
{
enable = ListView_GetCheckState(deviceList, selectedIndex) != 0;
@@ -651,7 +651,7 @@ void Configurator::updateButtons(int listIndex)
Button_SetCheck(useOriginalAPOPreMix, installState.useOriginalAPOPreMix && hasOriginalAPOPreMix);
Button_SetCheck(useOriginalAPOPostMix, installState.useOriginalAPOPostMix && hasOriginalAPOPostMix);
if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
ComboBox_SetCurSel(installModeComboBox, installState.installMode);
expandTroubleShooting(Button_GetCheck(toggleTroubleShooting) != 0);
@@ -660,9 +660,9 @@ void Configurator::updateButtons(int listIndex)
INT_PTR CALLBACK dlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
int APIENTRY wWinMain(HINSTANCE hInstance,
HINSTANCE /* hPrevInstance */,
LPWSTR lpCmdLine,
int nCmdShow)
HINSTANCE /* hPrevInstance */,
LPWSTR lpCmdLine,
int nCmdShow)
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
@@ -673,17 +673,17 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
int result = 0;
if(wcscmp(lpCmdLine, L"/u") == 0)
if (wcscmp(lpCmdLine, L"/u") == 0)
{
for(int index = 0; index <= 1; index++)
for (int index = 0; index <= 1; index++)
{
vector<DeviceAPOInfo> apoInfos = DeviceAPOInfo::loadAllInfos(index == 1);
for(vector<DeviceAPOInfo>::iterator it = apoInfos.begin(); it != apoInfos.end(); it++)
for (vector<DeviceAPOInfo>::iterator it = apoInfos.begin(); it != apoInfos.end(); it++)
{
try
{
if(it->isInstalled)
if (it->isInstalled)
it->uninstall();
}
catch (RegistryException e)
@@ -699,7 +699,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
configurator = new Configurator(hInstance, lpCmdLine);
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAINWINDOW), GetDesktopWindow(), dlgProc);
}
CoUninitialize();
return result;
@@ -716,7 +716,7 @@ INT_PTR CALLBACK dlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
return (INT_PTR)TRUE;
case WM_COMMAND:
if(configurator->onButtonClicked(LOWORD(wParam)))
if (configurator->onButtonClicked(LOWORD(wParam)))
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+112 -112
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.h"
@@ -73,12 +73,12 @@ vector<DeviceAPOInfo> DeviceAPOInfo::loadAllInfos(bool input)
vector<DeviceAPOInfo> result;
vector<wstring> deviceGuidStrings = RegistryHelper::enumSubKeys(input ? captureKeyPath : renderKeyPath);
wstring defaultDeviceGuid = getDefaultDevice(input);
for(vector<wstring>::iterator it = deviceGuidStrings.begin(); it != deviceGuidStrings.end(); it++)
for (vector<wstring>::iterator it = deviceGuidStrings.begin(); it != deviceGuidStrings.end(); it++)
{
wstring deviceGuidString = *it;
DeviceAPOInfo info;
if(info.load(deviceGuidString, defaultDeviceGuid))
if (info.load(deviceGuidString, defaultDeviceGuid))
{
info.selectedInstallState = info.currentInstallState;
result.push_back(info);
@@ -94,20 +94,20 @@ wstring DeviceAPOInfo::getDefaultDevice(bool input, int role)
IMMDeviceEnumerator* enumerator = NULL;
HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&enumerator);
if(SUCCEEDED(hr))
if (SUCCEEDED(hr))
{
IMMDevice* endPoint = NULL;
hr = enumerator->GetDefaultAudioEndpoint(input ? eCapture : eRender, (ERole)role, &endPoint);
if(SUCCEEDED(hr))
if (SUCCEEDED(hr))
{
IPropertyStore* propertyStore = NULL;
hr = endPoint->OpenPropertyStore(STGM_READ, &propertyStore);
if(SUCCEEDED(hr))
if (SUCCEEDED(hr))
{
PROPVARIANT variant;
PropVariantInit(&variant);
hr = propertyStore->GetValue(guidPropertyKey, &variant);
if(SUCCEEDED(hr))
if (SUCCEEDED(hr))
{
result = variant.pwszVal;
PropVariantClear(&variant);
@@ -142,16 +142,16 @@ bool DeviceAPOInfo::checkAPORegistration(bool fix)
bool result = true;
if (!RegistryHelper::keyExists(apoRegistrationKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID))
|| !RegistryHelper::keyExists(apoRegistrationKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID))
|| !RegistryHelper::keyExists(clsidKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID))
|| !RegistryHelper::keyExists(clsidKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID)))
|| !RegistryHelper::keyExists(apoRegistrationKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID))
|| !RegistryHelper::keyExists(clsidKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID))
|| !RegistryHelper::keyExists(clsidKeyPath L"\\" + RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID)))
{
result = false;
if (fix)
{
wchar_t path[MAX_PATH];
if(GetModuleFileNameW(NULL, path, MAX_PATH) != 0)
if (GetModuleFileNameW(NULL, path, MAX_PATH) != 0)
{
PathRemoveFileSpecW(path);
wstring params = wstring(L"/s \"") + path + L"\\EqualizerAPO.dll\"";
@@ -166,7 +166,7 @@ bool DeviceAPOInfo::checkAPORegistration(bool fix)
bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid)
{
wstring keyPath;
if(RegistryHelper::keyExists(renderKeyPath L"\\" + deviceGuid))
if (RegistryHelper::keyExists(renderKeyPath L"\\" + deviceGuid))
{
keyPath = renderKeyPath L"\\" + deviceGuid;
isInput = false;
@@ -178,7 +178,7 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid)
}
unsigned long deviceState = RegistryHelper::readDWORDValue(keyPath, L"DeviceState");
if(deviceState & DEVICE_STATE_NOTPRESENT)
if (deviceState & DEVICE_STATE_NOTPRESENT)
return false;
this->deviceGuid = deviceGuid;
@@ -189,35 +189,35 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid)
channelCount = 0;
sampleRate = 0;
channelMask = 0;
if(RegistryHelper::valueExists(keyPath + L"\\Properties", formatValueName))
if (RegistryHelper::valueExists(keyPath + L"\\Properties", formatValueName))
{
std::vector<unsigned char> format = RegistryHelper::readBinaryValue(keyPath + L"\\Properties", formatValueName);
if(format.size() >= sizeof(WAVEFORMATEX) + 8)
if (format.size() >= sizeof(WAVEFORMATEX) + 8)
{
WAVEFORMATEX* waveFormat = (WAVEFORMATEX*)&format[8];
channelCount = waveFormat->nChannels;
sampleRate = waveFormat->nSamplesPerSec;
if(waveFormat->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
if (waveFormat->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
WAVEFORMATEXTENSIBLE* waveFormatExtensible = (WAVEFORMATEXTENSIBLE*)waveFormat;
channelMask = waveFormatExtensible->dwChannelMask;
}
}
}
if(channelMask == 0 && RegistryHelper::valueExists(keyPath + L"\\Properties", channelMaskValueName))
if (channelMask == 0 && RegistryHelper::valueExists(keyPath + L"\\Properties", channelMaskValueName))
channelMask = RegistryHelper::readDWORDValue(keyPath + L"\\Properties", channelMaskValueName);
if(defaultDeviceGuid == L"")
if (defaultDeviceGuid == L"")
defaultDeviceGuid = getDefaultDevice(isInput);
GUID guid1, guid2;
if(SUCCEEDED(CLSIDFromString(deviceGuid.c_str(), &guid1)) && SUCCEEDED(CLSIDFromString(defaultDeviceGuid.c_str(), &guid2)))
if (SUCCEEDED(CLSIDFromString(deviceGuid.c_str(), &guid1)) && SUCCEEDED(CLSIDFromString(defaultDeviceGuid.c_str(), &guid2)))
isDefaultDevice = (guid1 == guid2) != 0;
else
isDefaultDevice = false;
isEnhancementsDisabled = false;
if(RegistryHelper::keyExists(keyPath + L"\\FxProperties") && RegistryHelper::valueExists(keyPath + L"\\FxProperties", disableEnhancementsValueName))
if (RegistryHelper::keyExists(keyPath + L"\\FxProperties") && RegistryHelper::valueExists(keyPath + L"\\FxProperties", disableEnhancementsValueName))
isEnhancementsDisabled = RegistryHelper::readDWORDValue(keyPath + L"\\FxProperties", disableEnhancementsValueName) != 0;
isInstalled = false;
@@ -230,16 +230,16 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid)
currentInstallState.useOriginalAPOPreMix = true;
currentInstallState.useOriginalAPOPostMix = !isInput;
if(!RegistryHelper::keyExists(keyPath + L"\\FxProperties"))
if (!RegistryHelper::keyExists(keyPath + L"\\FxProperties"))
{
for(int i = 0; i < allGuidValueNameCount; i++)
for (int i = 0; i < allGuidValueNameCount; i++)
originalApoGuids[i] = APOGUID_NOKEY;
}
else
{
for(int i = 0; i < allGuidValueNameCount; i++)
for (int i = 0; i < allGuidValueNameCount; i++)
{
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
originalApoGuids[i] = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]);
else
originalApoGuids[i] = APOGUID_NOVALUE;
@@ -247,18 +247,18 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid)
bool found = false;
bool foundAt[allGuidValueNameCount];
for(int i = 0; i < allGuidValueNameCount; i++)
for (int i = 0; i < allGuidValueNameCount; i++)
{
foundAt[i] = false;
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
{
wstring apoGuidString = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]);
GUID apoGuid;
if(SUCCEEDED(CLSIDFromString(apoGuidString.c_str(), &apoGuid)))
if (SUCCEEDED(CLSIDFromString(apoGuidString.c_str(), &apoGuid)))
{
if(apoGuid == EQUALIZERAPO_PRE_MIX_GUID || apoGuid == EQUALIZERAPO_POST_MIX_GUID)
if (apoGuid == EQUALIZERAPO_PRE_MIX_GUID || apoGuid == EQUALIZERAPO_POST_MIX_GUID)
{
foundAt[i] = true;
found = true;
@@ -267,16 +267,16 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid)
}
}
if(found)
if (found)
{
isInstalled = true;
if(RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid))
if (RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid))
{
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, versionValueName))
if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, versionValueName))
{
version = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, versionValueName);
if(version != installVersion)
if (version != installVersion)
throw RegistryException(L"Unsupported version of APO installation detected! Please uninstall newer Equalizer APO before using this version of Configurator.");
}
else
@@ -284,37 +284,37 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid)
version = L"1";
}
for(int i = 0; i < allGuidValueNameCount; i++)
for (int i = 0; i < allGuidValueNameCount; i++)
{
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, allGuidValueNames[i]))
if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, allGuidValueNames[i]))
originalApoGuids[i] = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i]);
}
if(version == installVersion)
if (version == installVersion)
{
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName))
if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName))
preMixChildGuid = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName);
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName))
if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName))
postMixChildGuid = RegistryHelper::readValue(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName);
currentInstallState.installPreMix = foundAt[LFX_INDEX] || foundAt[SFX_INDEX];
currentInstallState.installPostMix = foundAt[GFX_INDEX] || foundAt[MFX_INDEX] || foundAt[EFX_INDEX];
if(preMixChildGuid == L"")
if (preMixChildGuid == L"")
currentInstallState.useOriginalAPOPreMix = false;
if(postMixChildGuid == L"")
if (postMixChildGuid == L"")
currentInstallState.useOriginalAPOPostMix = false;
if(foundAt[LFX_INDEX] || foundAt[GFX_INDEX])
if (foundAt[LFX_INDEX] || foundAt[GFX_INDEX])
currentInstallState.installMode = INSTALL_LFX_GFX;
else if(foundAt[EFX_INDEX])
else if (foundAt[EFX_INDEX])
currentInstallState.installMode = INSTALL_SFX_EFX;
else if(foundAt[SFX_INDEX] || foundAt[MFX_INDEX])
else if (foundAt[SFX_INDEX] || foundAt[MFX_INDEX])
currentInstallState.installMode = INSTALL_SFX_MFX;
}
else
{
if(RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, lfxGuidValueName))
if (RegistryHelper::valueExists(childApoPath L"\\" + deviceGuid, lfxGuidValueName))
{
preMixChildGuid = originalApoGuids[0];
postMixChildGuid = originalApoGuids[1];
@@ -326,14 +326,14 @@ bool DeviceAPOInfo::load(const wstring& deviceGuid, wstring defaultDeviceGuid)
}
}
}
else if(RegistryHelper::valueExists(childApoPath, deviceGuid))
else if (RegistryHelper::valueExists(childApoPath, deviceGuid))
{
for(int i = 0; i < allGuidValueNameCount; i++)
for (int i = 0; i < allGuidValueNameCount; i++)
{
if(foundAt[i])
if (foundAt[i])
{
originalApoGuids[i] = RegistryHelper::readValue(childApoPath, deviceGuid);
if(i == LFX_INDEX || i == SFX_INDEX)
if (i == LFX_INDEX || i == SFX_INDEX)
preMixChildGuid = originalApoGuids[i];
else
postMixChildGuid = originalApoGuids[i];
@@ -365,29 +365,29 @@ bool DeviceAPOInfo::isExperimental()
wstring DeviceAPOInfo::getOriginalAPOPreMix()
{
wstring guid;
switch(selectedInstallState.installMode)
switch (selectedInstallState.installMode)
{
case INSTALL_LFX_GFX:
guid = originalApoGuids[LFX_INDEX];
if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
{
if(originalApoGuids[LFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[GFX_INDEX] == APOGUID_NOVALUE)
if (originalApoGuids[LFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[GFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[SFX_INDEX];
}
break;
case INSTALL_SFX_MFX:
guid = originalApoGuids[SFX_INDEX];
if(originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[MFX_INDEX] == APOGUID_NOVALUE)
if (originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[MFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[LFX_INDEX];
break;
case INSTALL_SFX_EFX:
guid = originalApoGuids[SFX_INDEX];
if(originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[EFX_INDEX] == APOGUID_NOVALUE)
if (originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[EFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[LFX_INDEX];
break;
}
if(guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE)
if (guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE)
guid = L"";
return guid;
@@ -396,29 +396,29 @@ wstring DeviceAPOInfo::getOriginalAPOPreMix()
wstring DeviceAPOInfo::getOriginalAPOPostMix()
{
wstring guid;
switch(selectedInstallState.installMode)
switch (selectedInstallState.installMode)
{
case INSTALL_LFX_GFX:
guid = originalApoGuids[GFX_INDEX];
if(RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
if (RegistryHelper::isWindowsVersionAtLeast(6, 3)) // Windows 8.1
{
if(originalApoGuids[LFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[GFX_INDEX] == APOGUID_NOVALUE)
if (originalApoGuids[LFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[GFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[MFX_INDEX];
}
break;
case INSTALL_SFX_MFX:
guid = originalApoGuids[MFX_INDEX];
if(originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[MFX_INDEX] == APOGUID_NOVALUE)
if (originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[MFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[GFX_INDEX];
break;
case INSTALL_SFX_EFX:
guid = originalApoGuids[EFX_INDEX];
if(originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[EFX_INDEX] == APOGUID_NOVALUE)
if (originalApoGuids[SFX_INDEX] == APOGUID_NOVALUE && originalApoGuids[EFX_INDEX] == APOGUID_NOVALUE)
guid = originalApoGuids[GFX_INDEX];
break;
}
if(guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE)
if (guid == APOGUID_NOKEY || guid == APOGUID_NOVALUE)
guid = L"";
return guid;
@@ -426,25 +426,25 @@ wstring DeviceAPOInfo::getOriginalAPOPostMix()
void DeviceAPOInfo::install()
{
if(!selectedInstallState.installPreMix && !selectedInstallState.installPostMix)
if (!selectedInstallState.installPreMix && !selectedInstallState.installPostMix)
return;
RegistryHelper::createKey(childApoPath);
RegistryHelper::createKey(childApoPath L"\\" + deviceGuid);
wstring keyPath;
if(!isInput)
if (!isInput)
keyPath = renderKeyPath L"\\" + deviceGuid;
else
keyPath = captureKeyPath L"\\" + deviceGuid;
if(!RegistryHelper::keyExists(keyPath + L"\\FxProperties"))
if (!RegistryHelper::keyExists(keyPath + L"\\FxProperties"))
{
try
{
RegistryHelper::createKey(keyPath + L"\\FxProperties");
}
catch(RegistryException e)
catch (RegistryException e)
{
// Permissions were not sufficient, so change them
RegistryHelper::takeOwnership(keyPath);
@@ -455,7 +455,7 @@ void DeviceAPOInfo::install()
RegistryHelper::writeValue(keyPath + L"\\FxProperties", fxTitleValueName, L"Equalizer APO");
for(int i = 0; i < allGuidValueNameCount; i++)
for (int i = 0; i < allGuidValueNameCount; i++)
{
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i], APOGUID_NOKEY);
}
@@ -464,10 +464,10 @@ void DeviceAPOInfo::install()
{
vector<wstring> valuenames;
for(int i = 0; i < allGuidValueNameCount; i++)
for (int i = 0; i < allGuidValueNameCount; i++)
{
wstring apoGuidString = APOGUID_NOVALUE;
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
{
apoGuidString = RegistryHelper::readValue(keyPath + L"\\FxProperties", allGuidValueNames[i]);
valuenames.push_back(allGuidValueNames[i]);
@@ -476,115 +476,115 @@ void DeviceAPOInfo::install()
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, allGuidValueNames[i], apoGuidString);
}
if(!valuenames.empty())
if (!valuenames.empty())
RegistryHelper::saveToFile(keyPath + L"\\FxProperties", valuenames,
L"backup_" + StringHelper::replaceIllegalCharacters(deviceName) + L"_" + StringHelper::replaceIllegalCharacters(connectionName) + L".reg");
L"backup_" + StringHelper::replaceIllegalCharacters(deviceName) + L"_" + StringHelper::replaceIllegalCharacters(connectionName) + L".reg");
}
wstring preMixValue;
wstring postMixValue;
if(selectedInstallState.useOriginalAPOPreMix)
if (selectedInstallState.useOriginalAPOPreMix)
preMixValue = getOriginalAPOPreMix();
if(selectedInstallState.useOriginalAPOPostMix)
if (selectedInstallState.useOriginalAPOPostMix)
postMixValue = getOriginalAPOPostMix();
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, preMixChildGuidValueName, preMixValue);
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, postMixChildGuidValueName, postMixValue);
RegistryHelper::writeValue(childApoPath L"\\" + deviceGuid, versionValueName, installVersion);
if(selectedInstallState.installMode == INSTALL_LFX_GFX)
if (selectedInstallState.installMode == INSTALL_LFX_GFX)
{
if(selectedInstallState.installPreMix)
if (selectedInstallState.installPreMix)
RegistryHelper::writeValue(keyPath + L"\\FxProperties", lfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID));
if(selectedInstallState.installPostMix && !isInput)
if (selectedInstallState.installPostMix && !isInput)
RegistryHelper::writeValue(keyPath + L"\\FxProperties", gfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID));
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxGuidValueName))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", sfxGuidValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxGuidValueName))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", mfxGuidValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxGuidValueName))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", efxGuidValueName);
}
else if(selectedInstallState.installMode == INSTALL_SFX_MFX)
else if (selectedInstallState.installMode == INSTALL_SFX_MFX)
{
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", lfxGuidValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", gfxGuidValueName);
if(selectedInstallState.installPreMix)
if (selectedInstallState.installPreMix)
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", sfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID));
if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName))
if (!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName))
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", sfxProcessingModesValueName, defaultProcessingModeValue);
}
if(selectedInstallState.installPostMix && !isInput)
if (selectedInstallState.installPostMix && !isInput)
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", mfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID));
if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxProcessingModesValueName))
if (!RegistryHelper::valueExists(keyPath + L"\\FxProperties", mfxProcessingModesValueName))
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", mfxProcessingModesValueName, defaultProcessingModeValue);
}
// don't change efx
}
else if(selectedInstallState.installMode == INSTALL_SFX_EFX)
else if (selectedInstallState.installMode == INSTALL_SFX_EFX)
{
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", lfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", lfxGuidValueName);
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", gfxGuidValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", gfxGuidValueName);
if(selectedInstallState.installPreMix)
if (selectedInstallState.installPreMix)
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", sfxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_PRE_MIX_GUID));
if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName))
if (!RegistryHelper::valueExists(keyPath + L"\\FxProperties", sfxProcessingModesValueName))
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", sfxProcessingModesValueName, defaultProcessingModeValue);
}
// don't change mfx
if(selectedInstallState.installPostMix && !isInput)
if (selectedInstallState.installPostMix && !isInput)
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", efxGuidValueName, RegistryHelper::getGuidString(EQUALIZERAPO_POST_MIX_GUID));
if(!RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxProcessingModesValueName))
if (!RegistryHelper::valueExists(keyPath + L"\\FxProperties", efxProcessingModesValueName))
RegistryHelper::writeMultiValue(keyPath + L"\\FxProperties", efxProcessingModesValueName, defaultProcessingModeValue);
}
}
// force-enable enhancements
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", disableEnhancementsValueName))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", disableEnhancementsValueName))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", disableEnhancementsValueName);
}
void DeviceAPOInfo::uninstall()
{
wstring keyPath;
if(!isInput)
if (!isInput)
keyPath = renderKeyPath L"\\" + deviceGuid;
else
keyPath = captureKeyPath L"\\" + deviceGuid;
if(originalApoGuids[0] == APOGUID_NOKEY)
if (originalApoGuids[0] == APOGUID_NOKEY)
{
RegistryHelper::deleteKey(keyPath + L"\\FxProperties");
}
else
{
for(int i = 0; i < allGuidValueNameCount; i++)
for (int i = 0; i < allGuidValueNameCount; i++)
{
if(originalApoGuids[i] == APOGUID_NOVALUE)
if (originalApoGuids[i] == APOGUID_NOVALUE)
{
if(RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
if (RegistryHelper::valueExists(keyPath + L"\\FxProperties", allGuidValueNames[i]))
RegistryHelper::deleteValue(keyPath + L"\\FxProperties", allGuidValueNames[i]);
}
else if(originalApoGuids[i] != L"")
else if (originalApoGuids[i] != L"")
{
RegistryHelper::writeValue(keyPath + L"\\FxProperties", allGuidValueNames[i], originalApoGuids[i]);
}
}
}
if(RegistryHelper::valueExists(childApoPath, deviceGuid))
if (RegistryHelper::valueExists(childApoPath, deviceGuid))
RegistryHelper::deleteValue(childApoPath, deviceGuid);
if(RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid))
if (RegistryHelper::keyExists(childApoPath L"\\" + deviceGuid))
RegistryHelper::deleteKey(childApoPath L"\\" + deviceGuid);
if(RegistryHelper::keyEmpty(childApoPath))
if (RegistryHelper::keyEmpty(childApoPath))
RegistryHelper::deleteKey(childApoPath);
}
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+22 -22
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2012 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.h"
@@ -33,7 +33,7 @@ static HINSTANCE hModule;
BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, void* lpReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
if (dwReason == DLL_PROCESS_ATTACH)
::hModule = hModule;
return TRUE;
@@ -41,7 +41,7 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, void* lpReserved)
STDAPI DllCanUnloadNow()
{
if(EqualizerAPO::instCount == 0 && ClassFactory::lockCount == 0)
if (EqualizerAPO::instCount == 0 && ClassFactory::lockCount == 0)
return S_OK;
else
return S_FALSE;
@@ -49,11 +49,11 @@ STDAPI DllCanUnloadNow()
STDAPI DllGetClassObject(const CLSID& clsid, const IID& iid, void** ppv)
{
if(clsid != EQUALIZERAPO_POST_MIX_GUID && clsid != EQUALIZERAPO_PRE_MIX_GUID)
if (clsid != EQUALIZERAPO_POST_MIX_GUID && clsid != EQUALIZERAPO_PRE_MIX_GUID)
return CLASS_E_CLASSNOTAVAILABLE;
ClassFactory* factory = new ClassFactory();
if(factory == NULL)
if (factory == NULL)
return E_OUTOFMEMORY;
HRESULT hr = factory->QueryInterface(iid, ppv);
@@ -65,17 +65,17 @@ STDAPI DllGetClassObject(const CLSID& clsid, const IID& iid, void** ppv)
STDAPI DllRegisterServer()
{
wchar_t filename[1024];
GetModuleFileNameW(hModule, filename, sizeof(filename)/sizeof(wchar_t));
GetModuleFileNameW(hModule, filename, sizeof(filename) / sizeof(wchar_t));
HRESULT hr = RegisterAPO(EqualizerAPO::regPostMixProperties);
if(FAILED(hr))
if (FAILED(hr))
{
UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID);
return hr;
}
hr = RegisterAPO(EqualizerAPO::regPreMixProperties);
if(FAILED(hr))
if (FAILED(hr))
{
UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID);
UnregisterAPO(EQUALIZERAPO_PRE_MIX_GUID);
@@ -100,7 +100,7 @@ STDAPI DllRegisterServer()
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32", L"", filename);
RegistryHelper::writeValue(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32", L"ThreadingModel", L"Both");
}
catch(RegistryException e)
catch (RegistryException e)
{
UnregisterAPO(EQUALIZERAPO_POST_MIX_GUID);
UnregisterAPO(EQUALIZERAPO_PRE_MIX_GUID);
@@ -124,7 +124,7 @@ STDAPI DllUnregisterServer()
RegistryHelper::deleteKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString + L"\\InprocServer32");
RegistryHelper::deleteKey(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\" + apoClsidString);
}
catch(RegistryException e)
catch (RegistryException e)
{
return E_FAIL;
}
+15 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <cmath>
@@ -31,11 +31,11 @@ AnalysisPlotScene::AnalysisPlotScene(QObject* parent)
void AnalysisPlotScene::setFreqData(fftwf_complex* freqData, int frameCount, unsigned sampleRate)
{
nodes.clear();
for(int i = 0; i < frameCount / 2; i++)
for (int i = 0; i < frameCount / 2; i++)
{
float freq = (i * 1.0f / frameCount) * sampleRate;
// GainIterator can't handle 0 Hz node
if(freq == 0.0f)
if (freq == 0.0f)
freq = 0.001f;
float gain = sqrt(freqData[i][0] * freqData[i][0] + freqData[i][1] * freqData[i][1]);
float dbGain = log10(gain) * 20;
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+17 -17
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
@@ -41,15 +41,15 @@ void AnalysisPlotView::drawBackground(QPainter* painter, const QRectF& rect)
QPainterPath path;
bool first = true;
double lastDb = -1000;
for(int x = rect.left() - 1; x <= rect.right() + 1; x++)
for (int x = rect.left() - 1; x <= rect.right() + 1; x++)
{
double hz = s->xToHz(x);
double db = gainIterator.gainAt(hz);
double y = s->dbToY(db);
if(db == lastDb)
if (db == lastDb)
y = floor(y) + 0.5;
lastDb = db;
if(first)
if (first)
{
path.moveTo(x, y);
first = false;
@@ -64,7 +64,7 @@ void AnalysisPlotView::drawBackground(QPainter* painter, const QRectF& rect)
path.lineTo(rect.left() - 1, rect.bottom() + 1);
double thresholdY = s->dbToY(0);
if(rect.top() < thresholdY)
if (rect.top() < thresholdY)
{
QPainterPath rectPath;
rectPath.addRect(rect.left(), rect.top(), rect.width(), min(thresholdY - rect.top(), rect.height()));
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+48 -48
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QElapsedTimer>
@@ -36,18 +36,18 @@ AnalysisThread::~AnalysisThread()
wait();
if(resultFreqData != NULL)
if (resultFreqData != NULL)
fftwf_free(resultFreqData);
if(buf != NULL)
if (buf != NULL)
delete buf;
if(buf2 != NULL)
if (buf2 != NULL)
delete buf2;
if(timeData != NULL)
if (timeData != NULL)
fftwf_free(timeData);
if(freqData != NULL)
if (freqData != NULL)
fftwf_free(freqData);
if(planForward != NULL)
if (planForward != NULL)
fftwf_destroy_plan(planForward);
}
@@ -115,12 +115,12 @@ int AnalysisThread::getProcessedFrames() const
void AnalysisThread::run()
{
while(true)
while (true)
{
mutex.lock();
if(!quit && this->frameCount == 0)
if (!quit && this->frameCount == 0)
condition.wait(&mutex);
if(quit)
if (quit)
{
mutex.unlock();
break;
@@ -138,13 +138,13 @@ void AnalysisThread::run()
timer.start();
unsigned channelCount = device.channelCount;
if(channelMask != 0 && channelMask != device.channelMask)
if (channelMask != 0 && channelMask != device.channelMask)
{
channelCount = 0;
for(int i = 0; i < 31; i++)
for (int i = 0; i < 31; i++)
{
int channelPos = 1 << i;
if(channelMask & channelPos)
if (channelMask & channelPos)
channelCount++;
}
}
@@ -157,31 +157,31 @@ void AnalysisThread::run()
engine.initialize(sampleRate, channelCount, channelCount, channelCount, channelMask, frameCount, configPath.toStdWString());
double initializationTime = (timer.nsecsElapsed() - startTime) / 1e6;
if(frameCount != lastFrameCount || channelCount != lastChannelCount)
if (frameCount != lastFrameCount || channelCount != lastChannelCount)
{
if(buf != NULL)
if (buf != NULL)
delete buf;
buf = new float[frameCount * channelCount];
memset(buf, 0, frameCount * channelCount * sizeof(float));
if(buf2 != NULL)
if (buf2 != NULL)
delete buf2;
buf2 = new float[frameCount * channelCount];
}
for(unsigned i = 0; i < channelCount; i++)
for (unsigned i = 0; i < channelCount; i++)
buf[i] = 1.0f;
if(frameCount != lastFrameCount)
if (frameCount != lastFrameCount)
{
if(timeData != NULL)
if (timeData != NULL)
fftwf_free(timeData);
timeData = fftwf_alloc_real(frameCount);
if(freqData != NULL)
if (freqData != NULL)
fftwf_free(freqData);
freqData = fftwf_alloc_complex(frameCount);
if(planForward != NULL)
if (planForward != NULL)
fftwf_destroy_plan(planForward);
planForward = fftwf_plan_dft_r2c_1d(frameCount, timeData, freqData, FFTW_ESTIMATE);
}
@@ -193,50 +193,50 @@ void AnalysisThread::run()
int startFrame = -1;
double processingTime = 0.0;
int processedFrames = 0;
while(true)
while (true)
{
qint64 startTime = timer.nsecsElapsed();
engine.process(buf2, buf, frameCount);
processingTime += (timer.nsecsElapsed() - startTime) / 1e6;
processedFrames += frameCount;
if(startFrame != -1)
if (startFrame != -1)
{
for(int i = 0; i < startFrame; i++)
for (int i = 0; i < startFrame; i++)
{
timeData[frameCount - startFrame + i] = buf2[i * channelCount + channelIndex];
}
break;
}
for(int i = 0; i < frameCount; i++)
for (int i = 0; i < frameCount; i++)
{
float s = buf2[i * channelCount + channelIndex];
if(abs(s) > 1e-5f)
if (abs(s) > 1e-5f)
{
startFrame = i;
break;
}
}
if(startFrame != -1)
if (startFrame != -1)
{
for(int i = 0; i < frameCount - startFrame; i++)
for (int i = 0; i < frameCount - startFrame; i++)
{
timeData[i] = buf2[(startFrame + i) * channelCount + channelIndex];
}
if(startFrame == 0)
if (startFrame == 0)
break;
}
if(latency == 0)
if (latency == 0)
{
for(unsigned i = 0; i < channelCount; i++)
for (unsigned i = 0; i < channelCount; i++)
buf[i] = 0.0f;
}
if(startFrame == -1)
if (startFrame == -1)
latency += frameCount;
}
latency += startFrame;
@@ -245,19 +245,19 @@ void AnalysisThread::run()
double peakGain = -DBL_MAX;
for(int i = 0; i < frameCount; i++)
for (int i = 0; i < frameCount; i++)
{
float sqrGain = freqData[i][0] * freqData[i][0] + freqData[i][1] * freqData[i][1];
if(sqrGain > peakGain)
if (sqrGain > peakGain)
peakGain = sqrGain;
}
peakGain = sqrt(peakGain);
peakGain = log10(peakGain) * 20.0;
mutex.lock();
if(this->freqDataLength != frameCount)
if (this->freqDataLength != frameCount)
{
if(resultFreqData != NULL)
if (resultFreqData != NULL)
fftwf_free(resultFreqData);
resultFreqData = fftwf_alloc_complex(frameCount);
}
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+5 -5
View File
@@ -111,8 +111,8 @@ SOURCES += main.cpp\
../parser/RegistryFunctions.cpp \
../parser/StringOperators.cpp \
AnalysisThread.cpp \
widgets/ExponentialSpinBox.cpp \
FilterTableMimeData.cpp
widgets/ExponentialSpinBox.cpp \
FilterTableMimeData.cpp
HEADERS += \
../helpers/LogHelper.h \
@@ -212,8 +212,8 @@ HEADERS += \
../parser/RegistryFunctions.h \
../parser/StringOperators.h \
AnalysisThread.h \
widgets/ExponentialSpinBox.h \
FilterTableMimeData.h
widgets/ExponentialSpinBox.h \
FilterTableMimeData.h
FORMS += \
guis/PreampFilterGUI.ui \
@@ -254,4 +254,4 @@ TRANSLATIONS += translations/Editor_de.ts
RC_ICONS = icons/accessories-text-editor.ico
DISTFILES +=
DISTFILES += ../uncrustify.cfg
+144 -145
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QDrag>
@@ -56,8 +56,8 @@
using namespace std;
FilterTable::FilterTable(MainWindow* mainWindow, QWidget *parent) :
QWidget(parent), mainWindow(mainWindow)
FilterTable::FilterTable(MainWindow* mainWindow, QWidget* parent)
: QWidget(parent), mainWindow(mainWindow)
{
gridLayout = new QGridLayout(this);
@@ -88,7 +88,7 @@ void FilterTable::initialize(QScrollArea* scrollArea, const QList<DeviceAPOInfo>
this->outputDevices = outputDevices;
this->inputDevices = inputDevices;
for(IFilterGUIFactory* factory : factories)
for (IFilterGUIFactory* factory : factories)
factory->initialize(this);
}
@@ -97,7 +97,7 @@ void FilterTable::updateDeviceAndChannelMask(DeviceAPOInfo* selectedDevice, int
this->selectedDevice = selectedDevice;
this->selectedChannelMask = channelMask;
if(!items.empty())
if (!items.empty())
updateGuis();
}
@@ -106,9 +106,9 @@ void FilterTable::updateGuis()
QElapsedTimer timer;
timer.start();
for(Item* item : items)
for (Item* item : items)
{
if(item->gui != NULL)
if (item->gui != NULL)
{
item->prefs.clear();
item->gui->storePreferences(item->prefs);
@@ -117,12 +117,12 @@ void FilterTable::updateGuis()
delete layout();
for(QObject* object : children())
for (QObject* object : children())
{
if(object != insertArrow)
if (object != insertArrow)
{
QWidget* widget = qobject_cast<QWidget*>(object);
if(widget != NULL)
if (widget != NULL)
widget->setVisible(false);
object->deleteLater();
}
@@ -137,16 +137,16 @@ void FilterTable::updateGuis()
gridLayout->setColumnStretch(0, 0);
gridLayout->setColumnStretch(1, 1);
for(IFilterGUIFactory* factory : factories)
for (IFilterGUIFactory* factory : factories)
factory->startOfFile(configPath);
int row = 0;
for(Item* item : items)
for (Item* item : items)
{
QString line = item->text;
IFilterGUI* gui = NULL;
int pos = line.indexOf(':');
if(pos != -1)
if (pos != -1)
{
QString key = line.mid(0, pos);
QString value = line.mid(pos + 1);
@@ -156,17 +156,17 @@ void FilterTable::updateGuis()
QString factoryKey = key;
QString factoryValue = value;
for(IFilterGUIFactory* factory : factories)
for (IFilterGUIFactory* factory : factories)
{
gui = factory->createFilterGUI(factoryKey, factoryValue);
if(gui != NULL || factoryKey == "")
if (gui != NULL || factoryKey == "")
break;
}
if(gui != NULL)
if (gui != NULL)
{
for(IFilterGUIFactory* factory : factories)
for (IFilterGUIFactory* factory : factories)
{
gui = factory->decorateFilterGUI(gui);
}
@@ -178,7 +178,7 @@ void FilterTable::updateGuis()
item->gui = gui;
if(gui != NULL)
if (gui != NULL)
{
gui->loadPreferences(item->prefs);
@@ -189,7 +189,7 @@ void FilterTable::updateGuis()
row++;
}
for(IFilterGUIFactory* factory : factories)
for (IFilterGUIFactory* factory : factories)
factory->endOfFile(configPath);
propagateChannels();
@@ -223,9 +223,9 @@ void FilterTable::propagateChannels()
{
vector<wstring> channelNames = ChannelHelper::getChannelNames(selectedDevice->channelCount, selectedChannelMask);
for(Item* item : items)
for (Item* item : items)
{
if(item->gui != NULL)
if (item->gui != NULL)
item->gui->configureChannels(channelNames);
}
}
@@ -233,7 +233,7 @@ void FilterTable::propagateChannels()
QList<QString> FilterTable::getLines()
{
QList<QString> result;
for(Item* item : items)
for (Item* item : items)
result.append(item->text);
return result;
@@ -246,7 +246,7 @@ void FilterTable::setLines(const QString& configPath, const QList<QString>& line
qDeleteAll(items);
items.clear();
for(QString line : lines)
for (QString line : lines)
{
items.append(new Item(line));
}
@@ -255,35 +255,35 @@ void FilterTable::setLines(const QString& configPath, const QList<QString>& line
settings.beginGroup(QString(configPath).replace('\\', '|'));
QVariant prefsValue = settings.value("rowPrefs");
QStringList prefLines;
if(prefsValue.isValid())
if (prefsValue.isValid())
prefLines = prefsValue.toStringList();
for(QString prefLine : prefLines)
for (QString prefLine : prefLines)
{
int index = prefLine.indexOf(':');
int lineNumber;
if(index != -1)
if (index != -1)
lineNumber = prefLine.left(index).toInt();
QString prefCommand;
QString prefString;
if(lineNumber > 0)
if (lineNumber > 0)
{
int index2 = prefLine.indexOf(':', index + 1);
if(index2 != -1)
if (index2 != -1)
{
prefCommand = prefLine.mid(index + 1, index2 - index - 1);
prefString = prefLine.mid(index2 + 1);
if(lineNumber <= items.size())
if (lineNumber <= items.size())
{
Item* item = items[lineNumber - 1];
QString command;
int index = item->text.indexOf(':');
if(index != -1)
if (index != -1)
command = item->text.left(index).trimmed();
if(command == prefCommand)
if (command == prefCommand)
item->prefs = QJsonDocument::fromJson(prefString.toUtf8()).toVariant().toMap();
}
}
@@ -292,7 +292,7 @@ void FilterTable::setLines(const QString& configPath, const QList<QString>& line
setScrollOffsets(settings.value("scrollX", 0).toInt(), settings.value("scrollY", 0).toInt());
settings.endGroup();
if(!items.isEmpty())
if (!items.isEmpty())
{
focused = items[0];
selectionStart = items[0];
@@ -310,7 +310,7 @@ FilterTable::Item* FilterTable::addLine(const QString& line, FilterTable::Item*
{
Item* newItem = new Item(line);
if(before != NULL)
if (before != NULL)
{
int index = items.indexOf(before);
items.insert(index, newItem);
@@ -337,21 +337,21 @@ QMenu* FilterTable::createAddPopupMenu()
QMenu* rootMenu = new QMenu;
pathMap[QStringList()] = rootMenu;
for(IFilterGUIFactory* f : factories)
for (IFilterGUIFactory* f : factories)
{
QList<FilterTemplate> templates = f->createFilterTemplates();
for(FilterTemplate t : templates)
for (FilterTemplate t : templates)
{
QMenu* menu = pathMap.value(t.getPath());
if(menu == NULL)
if (menu == NULL)
{
QMenu* parentMenu = rootMenu;
QStringList currentPath;
for(QString pathSegment : t.getPath())
for (QString pathSegment : t.getPath())
{
currentPath.append(pathSegment);
menu = pathMap.value(currentPath);
if(menu == NULL)
if (menu == NULL)
{
menu = new QMenu(pathSegment);
pathMap.insert(currentPath, menu);
@@ -380,11 +380,11 @@ void FilterTable::copy()
QString text;
QList<QVariantMap> prefsList;
bool first = true;
for(Item* item : items)
for (Item* item : items)
{
if(selected.contains(item))
if (selected.contains(item))
{
if(first)
if (first)
first = false;
else
text += "\n";
@@ -393,7 +393,7 @@ void FilterTable::copy()
}
}
if(selected.size() > 0)
if (selected.size() > 0)
{
FilterTableMimeData* mimeData = new FilterTableMimeData;
mimeData->setText(text);
@@ -407,12 +407,12 @@ void FilterTable::paste()
{
QClipboard* clipboard = QApplication::clipboard();
const QMimeData* mimeData = clipboard->mimeData();
if(mimeData->hasText())
if (mimeData->hasText())
{
int dropRow = items.size();
for(int i = 0; i < items.size(); i++)
for (int i = 0; i < items.size(); i++)
{
if(selected.contains(items[i]))
if (selected.contains(items[i]))
{
dropRow = i;
break;
@@ -423,21 +423,21 @@ void FilterTable::paste()
QStringList textLines = text.split("\n");
QList<QVariantMap> prefsList;
const FilterTableMimeData* filterTableMimeData = qobject_cast<const FilterTableMimeData*>(mimeData);
if(filterTableMimeData != NULL)
if (filterTableMimeData != NULL)
prefsList = filterTableMimeData->getPrefsList();
selected.clear();
focused = NULL;
selectionStart = NULL;
for(int i = 0; i < textLines.size(); i++)
for (int i = 0; i < textLines.size(); i++)
{
QString line = textLines[i];
Item* item = new Item(line);
if(!prefsList.isEmpty())
if (!prefsList.isEmpty())
item->prefs = prefsList[i];
selected.insert(item);
items.insert(dropRow++, item);
if(focused == NULL)
if (focused == NULL)
{
focused = item;
selectionStart = item;
@@ -452,13 +452,13 @@ void FilterTable::paste()
void FilterTable::deleteSelectedLines()
{
QList<Item*> newItems;
for(Item* item : items)
for (Item* item : items)
{
if(selected.contains(item))
if (selected.contains(item))
{
if(item == focused)
if (item == focused)
focused = NULL;
if(item == selectionStart)
if (item == selectionStart)
selectionStart = NULL;
delete item;
}
@@ -492,7 +492,7 @@ void FilterTable::addActionTriggered()
QPoint p = toolBar->mapToGlobal(QPoint(rect.x(), rect.y() + rect.height()));
QAction* action = menu->exec(p);
addAction->setChecked(false);
if(action != NULL)
if (action != NULL)
{
FilterTemplate t = action->data().value<FilterTemplate>();
QString line = t.getLine();
@@ -508,7 +508,7 @@ void FilterTable::openConfig(QString path)
int FilterTable::getPreferredWidth()
{
if(scrollArea == NULL)
if (scrollArea == NULL)
return width();
return scrollArea->viewport()->width();
@@ -516,7 +516,7 @@ int FilterTable::getPreferredWidth()
void FilterTable::updateSizeHints()
{
for(int i = 0; i < items.size(); i++)
for (int i = 0; i < items.size(); i++)
{
FilterTableRow* tableRow = qobject_cast<FilterTableRow*>(gridLayout->itemAtPosition(i, 0)->widget());
tableRow->updateGeometry();
@@ -526,7 +526,7 @@ void FilterTable::updateSizeHints()
QSize FilterTable::minimumSizeHint() const
{
QSize size = QWidget::minimumSizeHint();
if(size.height() < minimumHeightHint)
if (size.height() < minimumHeightHint)
size.setHeight(minimumHeightHint);
return size;
@@ -540,25 +540,25 @@ void FilterTable::setMinimumHeightHint(int height)
void FilterTable::savePreferences()
{
if(!configPath.isEmpty())
if (!configPath.isEmpty())
{
QStringList prefLines;
for(int i = 0; i < items.size(); i++)
for (int i = 0; i < items.size(); i++)
{
Item* item = items[i];
if(item->gui != NULL)
if (item->gui != NULL)
{
item->prefs.clear();
item->gui->storePreferences(item->prefs);
}
if(!item->prefs.isEmpty())
if (!item->prefs.isEmpty())
{
QString command;
int index = item->text.indexOf(':');
if(index != -1)
if (index != -1)
command = item->text.left(index).trimmed();
QByteArray byteArray = QJsonDocument::fromVariant(item->prefs).toJson(QJsonDocument::Compact);
@@ -584,26 +584,26 @@ void FilterTable::setScrollOffsets(int x, int y)
void FilterTable::mousePressEvent(QMouseEvent* event)
{
if(event->buttons() & Qt::LeftButton )
if (event->buttons() & Qt::LeftButton)
{
int row = rowForPos(event->pos(), false);
if(row != -1)
if (row != -1)
{
Item* item = items[row];
if(event->modifiers() & Qt::ControlModifier)
if (event->modifiers() & Qt::ControlModifier)
{
if(!selected.remove(item))
if (!selected.remove(item))
selected.insert(item);
selectionStart = item;
}
else if(event->modifiers() & Qt::ShiftModifier)
else if (event->modifiers() & Qt::ShiftModifier)
{
int startRow = items.indexOf(selectionStart);
if(startRow != -1)
if (startRow != -1)
{
selected.clear();
for(int i = min(startRow, row); i <= max(startRow, row); i++)
for (int i = min(startRow, row); i <= max(startRow, row); i++)
{
selected.insert(items[i]);
}
@@ -611,7 +611,7 @@ void FilterTable::mousePressEvent(QMouseEvent* event)
}
else
{
if(!selected.contains(item))
if (!selected.contains(item))
{
selected.clear();
selected.insert(item);
@@ -634,40 +634,40 @@ void FilterTable::mousePressEvent(QMouseEvent* event)
void FilterTable::mouseMoveEvent(QMouseEvent* event)
{
if(event->buttons() & Qt::LeftButton)
if (event->buttons() & Qt::LeftButton)
{
if((event->pos() - dragStartPos).manhattanLength() >= QApplication::startDragDistance())
if ((event->pos() - dragStartPos).manhattanLength() >= QApplication::startDragDistance())
{
QString text;
QList<QVariantMap> prefsList;
bool first = true;
int i = 0;
bool dragPosInside = false;
for(Item* item : items)
for (Item* item : items)
{
if(selected.contains(item))
if (selected.contains(item))
{
if(first)
if (first)
first = false;
else
text += "\n";
text += item->text;
if(item->gui != NULL)
if (item->gui != NULL)
item->gui->storePreferences(item->prefs);
prefsList.append(item->prefs);
if(!dragPosInside)
if (!dragPosInside)
{
FilterTableRow* tableRow = qobject_cast<FilterTableRow*>(gridLayout->itemAtPosition(i, 0)->widget());
QRect rect = tableRow->getHeaderRect().translated(tableRow->pos());
if(rect.contains(dragStartPos))
if (rect.contains(dragStartPos))
dragPosInside = true;
}
}
i++;
}
if(selected.size() > 0 && dragPosInside)
if (selected.size() > 0 && dragPosInside)
{
FilterTableMimeData* mimeData = new FilterTableMimeData;
mimeData->setText(text);
@@ -679,21 +679,21 @@ void FilterTable::mouseMoveEvent(QMouseEvent* event)
internalDrag = true;
Qt::DropAction action = drag->exec(Qt::MoveAction | Qt::CopyAction);
internalDrag = false;
if(action == Qt::MoveAction)
if (action == Qt::MoveAction)
{
for(Item* item : selectedBefore)
for (Item* item : selectedBefore)
{
items.removeOne(item);
if(focused == item)
if (focused == item)
focused = NULL;
if(selectionStart == item)
if (selectionStart == item)
selectionStart = NULL;
selected.remove(item);
delete item;
}
}
if(action != Qt::IgnoreAction)
if (action != Qt::IgnoreAction)
{
emit linesChanged();
updateGuis();
@@ -707,9 +707,9 @@ void FilterTable::mouseMoveEvent(QMouseEvent* event)
void FilterTable::dragEnterEvent(QDragEnterEvent* event)
{
if(event->mimeData()->hasText())
if (event->mimeData()->hasText())
{
if(event->keyboardModifiers() & Qt::ControlModifier)
if (event->keyboardModifiers() & Qt::ControlModifier)
event->setDropAction(Qt::CopyAction);
else
event->setDropAction(Qt::MoveAction);
@@ -721,9 +721,9 @@ void FilterTable::dragEnterEvent(QDragEnterEvent* event)
void FilterTable::dragMoveEvent(QDragMoveEvent* event)
{
if(event->mimeData()->hasText())
if (event->mimeData()->hasText())
{
if(event->keyboardModifiers() & Qt::ControlModifier)
if (event->keyboardModifiers() & Qt::ControlModifier)
event->setDropAction(Qt::CopyAction);
else
event->setDropAction(Qt::MoveAction);
@@ -748,9 +748,9 @@ void FilterTable::dragLeaveEvent(QDragLeaveEvent* event)
void FilterTable::dropEvent(QDropEvent* event)
{
const QMimeData* mimeData = event->mimeData();
if(mimeData->hasText())
if (mimeData->hasText())
{
if(event->keyboardModifiers() & Qt::ControlModifier)
if (event->keyboardModifiers() & Qt::ControlModifier)
event->setDropAction(Qt::CopyAction);
else
event->setDropAction(Qt::MoveAction);
@@ -759,25 +759,25 @@ void FilterTable::dropEvent(QDropEvent* event)
QStringList textLines = text.split("\n");
QList<QVariantMap> prefsList;
const FilterTableMimeData* filterTableMimeData = qobject_cast<const FilterTableMimeData*>(mimeData);
if(filterTableMimeData != NULL)
if (filterTableMimeData != NULL)
prefsList = filterTableMimeData->getPrefsList();
int dropRow = rowForPos(event->pos(), true);
if(dropRow == -1)
if (dropRow == -1)
dropRow = items.size();
selected.clear();
focused = NULL;
selectionStart = NULL;
for(int i = 0; i < textLines.size(); i++)
for (int i = 0; i < textLines.size(); i++)
{
QString line = textLines[i];
Item* item = new Item(line);
if(!prefsList.isEmpty())
if (!prefsList.isEmpty())
item->prefs = prefsList[i];
selected.insert(item);
items.insert(dropRow++, item);
if(focused == NULL)
if (focused == NULL)
{
focused = item;
selectionStart = item;
@@ -785,7 +785,7 @@ void FilterTable::dropEvent(QDropEvent* event)
}
event->accept();
if(!internalDrag)
if (!internalDrag)
{
emit linesChanged();
updateGuis();
@@ -799,32 +799,32 @@ void FilterTable::dropEvent(QDropEvent* event)
void FilterTable::keyPressEvent(QKeyEvent* event)
{
if(event->key() == Qt::Key_Down || event->key() == Qt::Key_Up)
if (event->key() == Qt::Key_Down || event->key() == Qt::Key_Up)
{
if(focused != NULL)
if (focused != NULL)
{
int row = items.indexOf(focused);
if(row != -1)
if (row != -1)
{
int newRow = row;
if(event->key() == Qt::Key_Down && row + 1 < items.size())
if (event->key() == Qt::Key_Down && row + 1 < items.size())
newRow = row + 1;
else if(event->key() == Qt::Key_Up && row - 1 >= 0)
else if (event->key() == Qt::Key_Up && row - 1 >= 0)
newRow = row - 1;
if(newRow != row)
if (newRow != row)
{
focused = items[newRow];
if(event->modifiers() & Qt::ControlModifier)
if (event->modifiers() & Qt::ControlModifier)
{
}
else if(event->modifiers() & Qt::ShiftModifier)
else if (event->modifiers() & Qt::ShiftModifier)
{
int startRow = items.indexOf(selectionStart);
if(startRow != -1)
if (startRow != -1)
{
selected.clear();
for(int i = min(startRow, newRow); i <= max(startRow, newRow); i++)
for (int i = min(startRow, newRow); i <= max(startRow, newRow); i++)
{
selected.insert(items[i]);
}
@@ -844,35 +844,35 @@ void FilterTable::keyPressEvent(QKeyEvent* event)
}
}
if(event->key() == Qt::Key_Space)
if (event->key() == Qt::Key_Space)
{
if(!(event->modifiers() & Qt::ControlModifier) || !selected.remove(focused))
if (!(event->modifiers() & Qt::ControlModifier) || !selected.remove(focused))
selected.insert(focused);
update();
}
if(event->key() == Qt::Key_F2)
if (event->key() == Qt::Key_F2)
{
if(focused != NULL)
if (focused != NULL)
{
int rowIndex = items.indexOf(focused);
if(rowIndex != -1)
if (rowIndex != -1)
{
QLayoutItem* layoutItem = gridLayout->itemAtPosition(rowIndex, 0);
FilterTableRow* tableRow = qobject_cast<FilterTableRow*>(layoutItem->widget());
if(tableRow != NULL)
if (tableRow != NULL)
tableRow->editText();
}
}
}
if(event->key() == Qt::Key_Delete)
if (event->key() == Qt::Key_Delete)
{
deleteSelectedLines();
}
}
void FilterTable::wheelEvent(QWheelEvent * event)
void FilterTable::wheelEvent(QWheelEvent* event)
{
scrollingNow = true;
scrollStartPoint = event->globalPos();
@@ -880,34 +880,33 @@ void FilterTable::wheelEvent(QWheelEvent * event)
QWidget::wheelEvent(event);
}
bool FilterTable::eventFilter(QObject* obj, QEvent* event)
{
QEvent::Type type = event->type();
if(scrollingNow)
if (scrollingNow)
{
if(type == QEvent::Wheel)
if (type == QEvent::Wheel)
{
QWidget* widget = qobject_cast<QWidget*>(obj);
if(widget != NULL)
if (widget != NULL)
{
if(isAncestorOf(widget))
if (isAncestorOf(widget))
{
QApplication::sendEvent(parent(), event);
return true;
}
}
}
else if(type == QEvent::MouseMove)
else if (type == QEvent::MouseMove)
{
QMouseEvent* mouseEvent = (QMouseEvent*)event;
if((mouseEvent->globalPos() - scrollStartPoint).manhattanLength() > QApplication::startDragDistance())
if ((mouseEvent->globalPos() - scrollStartPoint).manhattanLength() > QApplication::startDragDistance())
scrollingNow = false;
}
}
if(obj == scrollArea && type == QEvent::Resize)
if (obj == scrollArea && type == QEvent::Resize)
{
updateSizeHints();
}
@@ -917,13 +916,13 @@ bool FilterTable::eventFilter(QObject* obj, QEvent* event)
void FilterTable::showEvent(QShowEvent*)
{
if(presetScrollX != -1)
if (presetScrollX != -1)
{
scrollArea->horizontalScrollBar()->setValue(presetScrollX);
presetScrollX = -1;
}
if(presetScrollY != -1)
if (presetScrollY != -1)
{
scrollArea->verticalScrollBar()->setValue(presetScrollY);
presetScrollY = -1;
@@ -933,12 +932,12 @@ void FilterTable::showEvent(QShowEvent*)
void FilterTable::ensureRowVisible(int row)
{
QScrollBar* vScrollBar = scrollArea->verticalScrollBar();
if(vScrollBar != NULL)
if (vScrollBar != NULL)
{
QRect rect = rowRect(row).toAlignedRect();
if(rect.top() < vScrollBar->value())
if (rect.top() < vScrollBar->value())
vScrollBar->setValue(max(0, rect.top()));
else if(rect.bottom() + 1 > vScrollBar->value() + scrollArea->viewport()->height())
else if (rect.bottom() + 1 > vScrollBar->value() + scrollArea->viewport()->height())
vScrollBar->setValue(min(vScrollBar->maximum(), rect.bottom() + 1 - scrollArea->viewport()->height()));
}
}
@@ -946,16 +945,16 @@ void FilterTable::ensureRowVisible(int row)
int FilterTable::rowForPos(QPoint pos, bool insert)
{
int row = -1;
for(int i = 0; i < gridLayout->rowCount() - 2; i++)
for (int i = 0; i < gridLayout->rowCount() - 2; i++)
{
QRect rect = gridLayout->itemAtPosition(i, 0)->geometry();
int y;
if(insert)
if (insert)
y = rect.center().y();
else
y = rect.bottom();
if(pos.y() <= y)
if (pos.y() <= y)
{
row = i;
break;
@@ -975,12 +974,12 @@ QRectF FilterTable::rowRect(int row)
void FilterTable::disableWheelForWidgets()
{
QList<QWidget*> widgets = findChildren<QWidget*>();
for(QWidget* widget : widgets)
for (QWidget* widget : widgets)
{
if(qobject_cast<QComboBox*>(widget) || qobject_cast<QAbstractSpinBox*>(widget) || qobject_cast<QDial*>(widget))
if (qobject_cast<QComboBox*>(widget) || qobject_cast<QAbstractSpinBox*>(widget) || qobject_cast<QDial*>(widget))
{
widget->installEventFilter(new DisableWheelFilter(this, widget));
if(widget->focusPolicy() == Qt::WheelFocus)
if (widget->focusPolicy() == Qt::WheelFocus)
widget->setFocusPolicy(Qt::StrongFocus);
}
}
+21 -20
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -39,7 +39,8 @@ class FilterTable : public QWidget
{
Q_OBJECT
public:
struct Item {
struct Item
{
Item()
{
}
@@ -54,7 +55,7 @@ public:
IFilterGUI* gui = NULL;
};
explicit FilterTable(MainWindow* mainWindow, QWidget *parent = 0);
explicit FilterTable(MainWindow* mainWindow, QWidget* parent = 0);
void initialize(QScrollArea* scrollArea, const QList<DeviceAPOInfo>& outputDevices, const QList<DeviceAPOInfo>& inputDevices);
void updateDeviceAndChannelMask(DeviceAPOInfo* selectedDevice, int selectedChannelMask);
void updateGuis();
@@ -101,11 +102,11 @@ public slots:
protected:
void mousePressEvent(QMouseEvent* event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void mouseMoveEvent(QMouseEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;
void dragMoveEvent(QDragMoveEvent* event) override;
void dragLeaveEvent(QDragLeaveEvent* event) override;
void dropEvent(QDropEvent *event) override;
void dropEvent(QDropEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
void wheelEvent(QWheelEvent* event) override;
bool eventFilter(QObject* obj, QEvent* event) override;
@@ -144,7 +145,7 @@ template<typename T> inline uint qHash(QList<T> list)
{
uint hashValue = 0;
for(T t : list)
for (T t : list)
hashValue = 31 * hashValue + qHash(t);
return hashValue;
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "FilterTableMimeData.h"
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+28 -28
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QToolBar>
@@ -25,8 +25,8 @@
#include "FilterTableRow.h"
#include "ui_FilterTableRow.h"
FilterTableRow::FilterTableRow(FilterTable* table, int number, FilterTable::Item* item, IFilterGUI* gui) :
QWidget(table),
FilterTableRow::FilterTableRow(FilterTable* table, int number, FilterTable::Item* item, IFilterGUI* gui)
: QWidget(table),
ui(new Ui::FilterTableRow)
{
ui->setupUi(this);
@@ -44,7 +44,7 @@ FilterTableRow::FilterTableRow(FilterTable* table, int number, FilterTable::Item
ui->stackedWidget->setContentsMargins(0, 5, 0, 5);
if(gui != NULL)
if (gui != NULL)
{
connect(gui, SIGNAL(updateModel()), this, SLOT(updateModel()));
ui->stackedWidget->addWidget(gui);
@@ -70,7 +70,7 @@ QRect FilterTableRow::getHeaderRect()
void FilterTableRow::editText()
{
if(!ui->actionEditText->isChecked())
if (!ui->actionEditText->isChecked())
ui->actionEditText->trigger();
}
@@ -78,14 +78,14 @@ QSize FilterTableRow::sizeHint() const
{
QSize size = QWidget::minimumSizeHint();
int preferredWidth = table->getPreferredWidth();
if(size.width() < preferredWidth)
if (size.width() < preferredWidth)
size = QSize(preferredWidth, size.height());
return size;
}
void FilterTableRow::mouseDoubleClickEvent(QMouseEvent*)
{
if(gui == NULL && ui->stackedWidget->currentIndex() == 1)
if (gui == NULL && ui->stackedWidget->currentIndex() == 1)
ui->actionEditText->trigger();
}
@@ -98,16 +98,16 @@ void FilterTableRow::paintEvent(QPaintEvent*)
r = r.marginsAdded(QMarginsF(-1.5, -1.5, -1.5, -0.5));
QColor color;
if(table->getSelectedItems().contains(item))
if (table->getSelectedItems().contains(item))
{
if(table->getFocusedItem() == item)
if (table->getFocusedItem() == item)
color = QColor(44, 111, 222);
else
color = QColor(64, 136, 255);
}
else
{
if(table->getFocusedItem() == item)
if (table->getFocusedItem() == item)
color = QColor(160, 160, 160);
else
color = QColor(180, 180, 180);
@@ -149,7 +149,7 @@ void FilterTableRow::on_actionAdd_triggered()
QPoint p = ui->toolBar->mapToGlobal(QPoint(rect.x(), rect.y() + rect.height()));
QAction* action = menu->exec(p);
ui->actionAdd->setChecked(false);
if(action != NULL)
if (action != NULL)
{
FilterTemplate t = action->data().value<FilterTemplate>();
QString line = t.getLine();
@@ -166,9 +166,9 @@ void FilterTableRow::on_actionRemove_triggered()
void FilterTableRow::on_actionEditText_triggered(bool checked)
{
if(checked)
if (checked)
{
if(!lastEditTime.isValid() || lastEditTime.elapsed() > 100)
if (!lastEditTime.isValid() || lastEditTime.elapsed() > 100)
{
ui->lineEdit->setText(item->text);
ui->stackedWidget->setCurrentIndex(0);
@@ -183,9 +183,9 @@ void FilterTableRow::on_actionEditText_triggered(bool checked)
void FilterTableRow::on_lineEdit_editingFinished()
{
if(ui->stackedWidget->currentIndex() == 0 && !editingDone)
if (ui->stackedWidget->currentIndex() == 0 && !editingDone)
{
if(ui->lineEdit->text() != item->text)
if (ui->lineEdit->text() != item->text)
{
editingDone = true;
item->text = ui->lineEdit->text();
@@ -204,7 +204,7 @@ void FilterTableRow::on_lineEdit_editingFinished()
void FilterTableRow::on_lineEdit_editingCanceled()
{
if(ui->stackedWidget->currentIndex() == 0)
if (ui->stackedWidget->currentIndex() == 0)
{
// will cause editingFinished to be called, so prevent committing
editingDone = true;
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -55,7 +55,7 @@ private slots:
void on_lineEdit_editingCanceled();
private:
Ui::FilterTableRow *ui;
Ui::FilterTableRow* ui;
FilterTable* table;
FilterTable::Item* item;
IFilterGUI* gui;
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "FilterTemplate.h"
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+15 -15
View File
@@ -1,26 +1,26 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "IFilterGUI.h"
IFilterGUI::IFilterGUI(QWidget* parent) :
QWidget(parent)
IFilterGUI::IFilterGUI(QWidget* parent)
: QWidget(parent)
{
}
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "IFilterGUIFactory.h"
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+138 -138
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <sstream>
@@ -47,16 +47,16 @@
using namespace std;
MainWindow::MainWindow(QDir configDir, QWidget *parent) :
QMainWindow(parent), ui(new Ui::MainWindow), configDir(configDir)
MainWindow::MainWindow(QDir configDir, QWidget* parent)
: QMainWindow(parent), ui(new Ui::MainWindow), configDir(configDir)
{
outputDevices = QList<DeviceAPOInfo>::fromVector(QVector<DeviceAPOInfo>::fromStdVector(DeviceAPOInfo::loadAllInfos(false)));
inputDevices = QList<DeviceAPOInfo>::fromVector(QVector<DeviceAPOInfo>::fromStdVector(DeviceAPOInfo::loadAllInfos(true)));
defaultOutputDevice = NULL;
for(DeviceAPOInfo& apoInfo : outputDevices)
for (DeviceAPOInfo& apoInfo : outputDevices)
{
if(apoInfo.isDefaultDevice)
if (apoInfo.isDefaultDevice)
{
defaultOutputDevice = &apoInfo;
break;
@@ -68,7 +68,7 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) :
LogHelper::set(stderr, true, false, false);
QString version = QString("%0.%1").arg(MAJOR).arg(MINOR);
if(REVISION != 0)
if (REVISION != 0)
version += QString(".%0").arg(REVISION);
setWindowTitle(tr("Equalizer APO %0 Configuration Editor").arg(version));
@@ -103,7 +103,7 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) :
ui->mainToolBar->addWidget(channelConfigurationComboBox);
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(deviceComboBox->model());
if(defaultOutputDevice != NULL)
if (defaultOutputDevice != NULL)
deviceComboBox->addItem(tr("Default") + " (" + QString::fromStdWString(defaultOutputDevice->connectionName) + " - " + QString::fromStdWString(defaultOutputDevice->deviceName) + ")", NULL);
deviceComboBox->addItem(tr("Playback devices:"));
@@ -113,8 +113,8 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) :
item->setFont(font);
item->setSelectable(false);
for(DeviceAPOInfo& apoInfo : outputDevices)
if(apoInfo.isInstalled)
for (DeviceAPOInfo& apoInfo : outputDevices)
if (apoInfo.isInstalled)
deviceComboBox->addItem(QString::fromStdWString(apoInfo.connectionName) + " - " + QString::fromStdWString(apoInfo.deviceName), QVariant::fromValue(&apoInfo));
deviceComboBox->addItem(tr("Capture devices:"));
@@ -122,8 +122,8 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) :
item->setFont(font);
item->setSelectable(false);
for(DeviceAPOInfo& apoInfo : inputDevices)
if(apoInfo.isInstalled)
for (DeviceAPOInfo& apoInfo : inputDevices)
if (apoInfo.isInstalled)
deviceComboBox->addItem(QString::fromStdWString(apoInfo.connectionName) + " - " + QString::fromStdWString(apoInfo.deviceName), QVariant::fromValue(&apoInfo));
connect(channelConfigurationComboBox, SIGNAL(activated(int)), this, SLOT(channelConfigurationSelected(int)));
@@ -136,21 +136,21 @@ MainWindow::MainWindow(QDir configDir, QWidget *parent) :
connect(analysisThread, SIGNAL(analysisFinished()), this, SLOT(updateAnalysisPanel()));
QLocale autoLocale = QLocale::system();
if(autoLocale.language() != QLocale::German)
if (autoLocale.language() != QLocale::German)
autoLocale = QLocale("en");
QLocale::Language languages[] = {QLocale::AnyLanguage, QLocale::English, QLocale::German};
for(int i = 0; i < sizeof(languages) / sizeof(QLocale::Language); i++)
for (int i = 0; i < sizeof(languages) / sizeof(QLocale::Language); i++)
{
QLocale::Language language = languages[i];
QString languageName;
if(language == QLocale::AnyLanguage)
if (language == QLocale::AnyLanguage)
languageName = autoLocale.nativeLanguageName();
else
languageName = QLocale(language).nativeLanguageName();
if(languageName == "American English")
if (languageName == "American English")
languageName = "English";
QString text;
if(language == QLocale::AnyLanguage)
if (language == QLocale::AnyLanguage)
text = tr("Automatic (%0)").arg(languageName);
else
text = languageName;
@@ -172,18 +172,18 @@ MainWindow::~MainWindow()
void MainWindow::doChecks()
{
if(!DeviceAPOInfo::checkProtectedAudioDG(false) || !DeviceAPOInfo::checkAPORegistration(false))
if (!DeviceAPOInfo::checkProtectedAudioDG(false) || !DeviceAPOInfo::checkAPORegistration(false))
{
if(QMessageBox::warning(this, tr("Registry problem"), tr("A registry value that is required for the operation of Equalizer APO is not set correctly.\nDo you want to run the Configurator application to fix the problem?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
if (QMessageBox::warning(this, tr("Registry problem"), tr("A registry value that is required for the operation of Equalizer APO is not set correctly.\nDo you want to run the Configurator application to fix the problem?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
runConfigurator();
return;
}
}
if(!defaultOutputDevice->isInstalled)
if (!defaultOutputDevice->isInstalled)
{
if(QMessageBox::warning(this, tr("APO not installed to device"), tr("Equalizer APO has not been installed to the selected device.\nDo you want to run the Configurator application to fix the problem?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
if (QMessageBox::warning(this, tr("APO not installed to device"), tr("Equalizer APO has not been installed to the selected device.\nDo you want to run the Configurator application to fix the problem?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
runConfigurator();
return;
@@ -191,20 +191,20 @@ void MainWindow::doChecks()
}
DeviceAPOInfo* disabledApoInfo = NULL;
for(DeviceAPOInfo& apoInfo : outputDevices)
for (DeviceAPOInfo& apoInfo : outputDevices)
{
if(apoInfo.isInstalled && apoInfo.isEnhancementsDisabled)
if (apoInfo.isInstalled && apoInfo.isEnhancementsDisabled)
{
disabledApoInfo = &apoInfo;
break;
}
}
if(disabledApoInfo == NULL)
if (disabledApoInfo == NULL)
{
for(DeviceAPOInfo& apoInfo : inputDevices)
for (DeviceAPOInfo& apoInfo : inputDevices)
{
if(apoInfo.isInstalled && apoInfo.isEnhancementsDisabled)
if (apoInfo.isInstalled && apoInfo.isEnhancementsDisabled)
{
disabledApoInfo = &apoInfo;
break;
@@ -212,9 +212,9 @@ void MainWindow::doChecks()
}
}
if(disabledApoInfo != NULL)
if (disabledApoInfo != NULL)
{
if(QMessageBox::warning(this, tr("Audio enhancements disabled"), tr("Audio enhancements are not enabled for the device\n%0 %1.\nDo you want to run the Configurator application to fix the problem?").arg(QString::fromStdWString(disabledApoInfo->connectionName)).arg(QString::fromStdWString(disabledApoInfo->deviceName)), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
if (QMessageBox::warning(this, tr("Audio enhancements disabled"), tr("Audio enhancements are not enabled for the device\n%0 %1.\nDo you want to run the Configurator application to fix the problem?").arg(QString::fromStdWString(disabledApoInfo->connectionName)).arg(QString::fromStdWString(disabledApoInfo->deviceName)), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
runConfigurator();
return;
@@ -227,7 +227,7 @@ void MainWindow::runConfigurator()
// cannot use QProcess::startDetached because of UAC
wstring file = (QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/Configurator.exe")).toStdWString();
int result = (int)ShellExecuteW(NULL, L"open", file.c_str(), NULL, NULL, SW_SHOWNORMAL);
if(result == SE_ERR_ACCESSDENIED)
if (result == SE_ERR_ACCESSDENIED)
ShellExecuteW(NULL, L"runas", file.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
@@ -235,12 +235,12 @@ void MainWindow::load(QString path)
{
path = QDir::toNativeSeparators(path);
for(int i = 0; i < ui->tabWidget->count(); i++)
for (int i = 0; i < ui->tabWidget->count(); i++)
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->widget(i));
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
if(filterTable->getConfigPath() == path)
if (filterTable->getConfigPath() == path)
{
ui->tabWidget->setCurrentIndex(i);
return;
@@ -251,13 +251,13 @@ void MainWindow::load(QString path)
timer.start();
HANDLE hFile = INVALID_HANDLE_VALUE;
while(hFile == INVALID_HANDLE_VALUE)
while (hFile == INVALID_HANDLE_VALUE)
{
hFile = CreateFile(path.toStdWString().c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
if (hFile == INVALID_HANDLE_VALUE)
{
DWORD error = GetLastError();
if(error != ERROR_SHARING_VIOLATION)
if (error != ERROR_SHARING_VIOLATION)
{
QMessageBox::critical(this, tr("Error"), tr("Error while reading configuration file: %0").arg(QString::fromStdWString(StringHelper::getSystemErrorString(error))));
return;
@@ -272,7 +272,7 @@ void MainWindow::load(QString path)
char buf[8192];
unsigned long bytesRead = -1;
while(ReadFile(hFile, buf, sizeof(buf), &bytesRead, NULL) && bytesRead != 0)
while (ReadFile(hFile, buf, sizeof(buf), &bytesRead, NULL) && bytesRead != 0)
{
inputStream.write(buf, bytesRead);
}
@@ -282,15 +282,15 @@ void MainWindow::load(QString path)
inputStream.seekg(0);
QList<QString> lines;
while(inputStream.good())
while (inputStream.good())
{
string encodedLine;
getline(inputStream, encodedLine);
if(encodedLine.size() > 0 && encodedLine[encodedLine.size() - 1] == '\r')
if (encodedLine.size() > 0 && encodedLine[encodedLine.size() - 1] == '\r')
encodedLine.resize(encodedLine.size() - 1);
wstring line = StringHelper::toWString(encodedLine, CP_UTF8);
if(line.find(L'\uFFFD') != -1)
if (line.find(L'\uFFFD') != -1)
line = StringHelper::toWString(encodedLine, CP_ACP);
lines.append(QString::fromStdWString(line));
@@ -309,7 +309,7 @@ void MainWindow::load(QString path)
recentFiles.removeAll(path);
recentFiles.prepend(path);
if(recentFiles.size() > 10)
if (recentFiles.size() > 10)
recentFiles.removeLast();
updateRecentFiles();
}
@@ -323,9 +323,9 @@ void MainWindow::save(FilterTable* filterTable, QString path)
bool first = true;
QByteArray byteArray;
for(QString line : lines)
for (QString line : lines)
{
if(first)
if (first)
first = false;
else
byteArray.append("\r\n");
@@ -333,13 +333,13 @@ void MainWindow::save(FilterTable* filterTable, QString path)
}
HANDLE hFile = INVALID_HANDLE_VALUE;
while(hFile == INVALID_HANDLE_VALUE)
while (hFile == INVALID_HANDLE_VALUE)
{
hFile = CreateFile(path.toStdWString().c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
if (hFile == INVALID_HANDLE_VALUE)
{
DWORD error = GetLastError();
if(error != ERROR_SHARING_VIOLATION)
if (error != ERROR_SHARING_VIOLATION)
{
QMessageBox::critical(this, tr("Error"), tr("Error while writing configuration file: %0").arg(QString::fromStdWString(StringHelper::getSystemErrorString(error))));
return;
@@ -352,7 +352,7 @@ void MainWindow::save(FilterTable* filterTable, QString path)
unsigned long bytesWritten;
WriteFile(hFile, byteArray.constData(), byteArray.length(), &bytesWritten, NULL);
if(bytesWritten != byteArray.length())
if (bytesWritten != byteArray.length())
{
// should never happen
QMessageBox::critical(this, tr("Error"), tr("Only %0/%1 bytes have been written!").arg(bytesWritten).arg(byteArray.length()));
@@ -378,16 +378,16 @@ bool MainWindow::shouldRestart()
void MainWindow::closeEvent(QCloseEvent* event)
{
bool canceled = false;
for(int i = 0; i < ui->tabWidget->count(); i++)
for (int i = 0; i < ui->tabWidget->count(); i++)
{
if(!askForClose(i))
if (!askForClose(i))
{
canceled = true;
break;
}
}
if(canceled)
if (canceled)
{
event->ignore();
restart = false;
@@ -403,32 +403,32 @@ void MainWindow::closeEvent(QCloseEvent* event)
void MainWindow::deviceSelected(int index)
{
DeviceAPOInfo* apoInfo = deviceComboBox->itemData(index).value<DeviceAPOInfo*>();
if(apoInfo == NULL)
if (apoInfo == NULL)
apoInfo = defaultOutputDevice;
channelConfigurationComboBox->clear();
const QList<GUIChannelHelper::ChannelConfigurationInfo>& infos = GUIChannelHelper::getInstance()->getChannelConfigurationInfos();
if(apoInfo != NULL)
if (apoInfo != NULL)
{
const GUIChannelHelper::ChannelConfigurationInfo* selectedInfo = NULL;
for(const GUIChannelHelper::ChannelConfigurationInfo& info : infos)
for (const GUIChannelHelper::ChannelConfigurationInfo& info : infos)
{
if(info.channelMask == apoInfo->channelMask)
if (info.channelMask == apoInfo->channelMask)
{
selectedInfo = &info;
break;
}
}
if(selectedInfo != NULL)
if (selectedInfo != NULL)
channelConfigurationComboBox->addItem(tr("From device") + " (" + selectedInfo->name + ")", 0);
else
channelConfigurationComboBox->addItem(tr("From device") + " (" + apoInfo->channelCount + " channels)", 0);
}
for(const GUIChannelHelper::ChannelConfigurationInfo& info : infos)
for (const GUIChannelHelper::ChannelConfigurationInfo& info : infos)
channelConfigurationComboBox->addItem(info.name, info.channelMask);
channelConfigurationSelected(channelConfigurationComboBox->currentIndex());
@@ -440,7 +440,7 @@ void MainWindow::channelConfigurationSelected(int index)
int channelMask;
getDeviceAndChannelMask(&selectedDevice, &channelMask);
for(int i = 0; i < ui->tabWidget->count(); i++)
for (int i = 0; i < ui->tabWidget->count(); i++)
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->widget(i));
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
@@ -449,22 +449,22 @@ void MainWindow::channelConfigurationSelected(int index)
ui->analysisChannelComboBox->clear();
if(selectedDevice != NULL)
if (selectedDevice != NULL)
{
unsigned channelCount = selectedDevice->channelCount;
if(channelMask != 0 && channelMask != selectedDevice->channelMask)
if (channelMask != 0 && channelMask != selectedDevice->channelMask)
{
channelCount = 0;
for(int i = 0; i < 31; i++)
for (int i = 0; i < 31; i++)
{
int channelPos = 1 << i;
if(channelMask & channelPos)
if (channelMask & channelPos)
channelCount++;
}
}
vector<wstring> channelNames = ChannelHelper::getChannelNames(channelCount, channelMask);
for(wstring channelName : channelNames)
for (wstring channelName : channelNames)
{
ui->analysisChannelComboBox->addItem(QString::fromStdWString(channelName));
}
@@ -475,10 +475,10 @@ void MainWindow::linesChanged()
{
FilterTable* filterTable = qobject_cast<FilterTable*>(sender());
if(instantModeCheckBox->isChecked())
if (instantModeCheckBox->isChecked())
{
QString configPath = filterTable->getConfigPath();
if(configPath.length() > 0)
if (configPath.length() > 0)
{
save(filterTable, configPath);
return;
@@ -486,17 +486,17 @@ void MainWindow::linesChanged()
}
int tabIndex = -1;
for(int i = 0; i < ui->tabWidget->count(); i++)
for (int i = 0; i < ui->tabWidget->count(); i++)
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->widget(i));
if(scrollArea->widget() == filterTable)
if (scrollArea->widget() == filterTable)
{
tabIndex = i;
break;
}
}
QString tabText = ui->tabWidget->tabText(tabIndex);
if(!tabText.endsWith('*'))
if (!tabText.endsWith('*'))
{
tabText += '*';
ui->tabWidget->setTabText(tabIndex, tabText);
@@ -505,7 +505,7 @@ void MainWindow::linesChanged()
bool MainWindow::on_tabWidget_tabCloseRequested(int index)
{
if(askForClose(index))
if (askForClose(index))
ui->tabWidget->removeTab(index);
return true;
}
@@ -514,25 +514,25 @@ void MainWindow::on_actionOpen_triggered()
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->currentWidget());
QString path;
if(scrollArea != NULL)
if (scrollArea != NULL)
{
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
if(filterTable->getConfigPath().length() > 0)
if (filterTable->getConfigPath().length() > 0)
{
QFileInfo fileInfo(filterTable->getConfigPath());
path = fileInfo.absolutePath();
}
}
if(path.length() == 0)
if (path.length() == 0)
path = configDir.absolutePath();
QFileDialog dialog(this, tr("Open file"), path, "*.txt");
dialog.setFileMode(QFileDialog::ExistingFiles);
dialog.setNameFilter(tr("E-APO configurations (*.txt)"));
if(dialog.exec() == QDialog::Accepted)
if (dialog.exec() == QDialog::Accepted)
{
for(QString file : dialog.selectedFiles())
for (QString file : dialog.selectedFiles())
load(file);
}
}
@@ -540,12 +540,12 @@ void MainWindow::on_actionOpen_triggered()
void MainWindow::on_actionSave_triggered()
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->currentWidget());
if(scrollArea == NULL)
if (scrollArea == NULL)
return;
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
if(filterTable->getConfigPath().length() == 0)
if (filterTable->getConfigPath().length() == 0)
{
ui->actionSaveAs->trigger();
}
@@ -554,7 +554,7 @@ void MainWindow::on_actionSave_triggered()
save(filterTable, filterTable->getConfigPath());
QString tabText = ui->tabWidget->tabText(ui->tabWidget->currentIndex());
if(tabText.endsWith('*'))
if (tabText.endsWith('*'))
ui->tabWidget->setTabText(ui->tabWidget->currentIndex(), tabText.left(tabText.length() - 1));
}
}
@@ -562,13 +562,13 @@ void MainWindow::on_actionSave_triggered()
void MainWindow::on_actionSaveAs_triggered()
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->currentWidget());
if(scrollArea == NULL)
if (scrollArea == NULL)
return;
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
QString path;
QString filename;
if(filterTable->getConfigPath().length() == 0)
if (filterTable->getConfigPath().length() == 0)
{
path = configDir.absolutePath();
}
@@ -583,10 +583,10 @@ void MainWindow::on_actionSaveAs_triggered()
dialog.setAcceptMode(QFileDialog::AcceptSave);
dialog.setNameFilter(tr("E-APO configurations (*.txt)"));
dialog.setDefaultSuffix(".txt");
if(filename.length() > 0)
if (filename.length() > 0)
dialog.selectFile(filename);
if(dialog.exec() == QDialog::Accepted)
if (dialog.exec() == QDialog::Accepted)
{
QString savePath = dialog.selectedFiles().first();
save(filterTable, savePath);
@@ -616,7 +616,7 @@ void MainWindow::recentFileSelected()
void MainWindow::on_actionCut_triggered()
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->currentWidget());
if(scrollArea == NULL)
if (scrollArea == NULL)
return;
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
@@ -626,7 +626,7 @@ void MainWindow::on_actionCut_triggered()
void MainWindow::on_actionCopy_triggered()
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->currentWidget());
if(scrollArea == NULL)
if (scrollArea == NULL)
return;
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
@@ -636,7 +636,7 @@ void MainWindow::on_actionCopy_triggered()
void MainWindow::on_actionPaste_triggered()
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->currentWidget());
if(scrollArea == NULL)
if (scrollArea == NULL)
return;
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
@@ -646,7 +646,7 @@ void MainWindow::on_actionPaste_triggered()
void MainWindow::on_actionDelete_triggered()
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->currentWidget());
if(scrollArea == NULL)
if (scrollArea == NULL)
return;
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
@@ -655,19 +655,19 @@ void MainWindow::on_actionDelete_triggered()
void MainWindow::instantModeEnabled(bool enabled)
{
if(enabled)
if (enabled)
{
for(int i = 0; i < ui->tabWidget->count(); i++)
for (int i = 0; i < ui->tabWidget->count(); i++)
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->widget(i));
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
if(filterTable->getConfigPath().length() > 0)
if (filterTable->getConfigPath().length() > 0)
{
save(filterTable, filterTable->getConfigPath());
QString tabText = ui->tabWidget->tabText(i);
if(tabText.endsWith('*'))
if (tabText.endsWith('*'))
ui->tabWidget->setTabText(i, tabText.left(tabText.length() - 1));
}
}
@@ -740,7 +740,7 @@ void MainWindow::languageSelected(bool selected)
{
QAction* action = qobject_cast<QAction*>(sender());
if(!selected)
if (!selected)
{
action->setChecked(true);
return;
@@ -748,10 +748,10 @@ void MainWindow::languageSelected(bool selected)
QLocale::Language language = (QLocale::Language)action->data().toInt();
if(QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes)
if (QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes)
{
QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat);
if(language == QLocale::AnyLanguage)
if (language == QLocale::AnyLanguage)
{
settings.remove("language");
}
@@ -759,7 +759,7 @@ void MainWindow::languageSelected(bool selected)
{
QString name = QLocale(language).name();
int index = name.indexOf('_');
if(index != -1)
if (index != -1)
name = name.left(index);
settings.setValue("language", name);
}
@@ -775,15 +775,15 @@ void MainWindow::languageSelected(bool selected)
void MainWindow::on_actionResetAllGlobalPreferences_triggered()
{
if(QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes)
if (QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes)
{
QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat);
for(QString key : settings.childGroups())
for (QString key : settings.childGroups())
{
if(key != "file-specific")
if (key != "file-specific")
settings.remove(key);
}
for(QString key : settings.childKeys())
for (QString key : settings.childKeys())
settings.remove(key);
restart = true;
@@ -794,12 +794,12 @@ void MainWindow::on_actionResetAllGlobalPreferences_triggered()
void MainWindow::on_actionResetAllFileSpecificPreferences_triggered()
{
if(QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes)
if (QMessageBox::question(this, tr("Restart required"), tr("Configuration Editor will be restarted to apply the changed settings. Proceed?")) == QMessageBox::Yes)
{
QSettings settings(QString::fromWCharArray(EDITOR_PER_FILE_REGPATH), QSettings::NativeFormat);
for(QString key : settings.childGroups())
for (QString key : settings.childGroups())
settings.remove(key);
for(QString key : settings.childKeys())
for (QString key : settings.childKeys())
settings.remove(key);
restart = true;
@@ -832,15 +832,15 @@ FilterTable* MainWindow::addTab(QString title, QString tooltip)
void MainWindow::getDeviceAndChannelMask(DeviceAPOInfo** selectedDevice, int* channelMask)
{
*selectedDevice = deviceComboBox->currentData().value<DeviceAPOInfo*>();
if(*selectedDevice == NULL)
if (*selectedDevice == NULL)
*selectedDevice = defaultOutputDevice;
*channelMask = channelConfigurationComboBox->currentData().toInt();
if(*channelMask == 0 && selectedDevice != NULL)
if (*channelMask == 0 && selectedDevice != NULL)
{
*channelMask = (*selectedDevice)->channelMask;
if(*channelMask == 0)
if (*channelMask == 0)
*channelMask = ChannelHelper::getDefaultChannelMask((*selectedDevice)->channelCount);
}
}
@@ -848,7 +848,7 @@ void MainWindow::getDeviceAndChannelMask(DeviceAPOInfo** selectedDevice, int* ch
bool MainWindow::askForClose(int tabIndex)
{
bool discarded = false;
if(ui->tabWidget->tabText(tabIndex).endsWith('*'))
if (ui->tabWidget->tabText(tabIndex).endsWith('*'))
{
ui->tabWidget->setCurrentIndex(tabIndex);
QString configPath = ui->tabWidget->tabToolTip(tabIndex);
@@ -863,11 +863,11 @@ bool MainWindow::askForClose(int tabIndex)
messageBox.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
int result = messageBox.exec();
switch(result)
switch (result)
{
case QMessageBox::Save:
ui->actionSave->trigger();
if(ui->tabWidget->tabText(tabIndex).endsWith('*'))
if (ui->tabWidget->tabText(tabIndex).endsWith('*'))
// saving was canceled
return false;
break;
@@ -879,10 +879,10 @@ bool MainWindow::askForClose(int tabIndex)
}
}
if(!discarded && !noSaveFilePreferences)
if (!discarded && !noSaveFilePreferences)
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->widget(tabIndex));
if(scrollArea != NULL)
if (scrollArea != NULL)
{
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
filterTable->savePreferences();
@@ -899,23 +899,23 @@ void MainWindow::startAnalysis()
int channelMask;
getDeviceAndChannelMask(&selectedDevice, &channelMask);
if(selectedDevice != NULL)
if (selectedDevice != NULL)
{
QString configPath;
if(ui->startFromComboBox->currentIndex() == 1)
if (ui->startFromComboBox->currentIndex() == 1)
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->currentWidget());
if(scrollArea != NULL)
if (scrollArea != NULL)
{
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
if(filterTable->getConfigPath().length() > 0)
if (filterTable->getConfigPath().length() > 0)
configPath = filterTable->getConfigPath();
}
}
if(configPath.isEmpty())
if (configPath.isEmpty())
configPath = configDir.absoluteFilePath("config.txt");
configPath = QDir::toNativeSeparators(configPath);
@@ -927,10 +927,10 @@ void MainWindow::loadPreferences()
{
QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat);
QVariant geometryValue = settings.value("geometry");
if(geometryValue.isValid())
if (geometryValue.isValid())
restoreGeometry(geometryValue.toByteArray());
QVariant stateValue = settings.value("windowState");
if(stateValue.isValid())
if (stateValue.isValid())
restoreState(stateValue.toByteArray());
instantModeCheckBox->setChecked(settings.value("instantMode", true).toBool());
@@ -939,7 +939,7 @@ void MainWindow::loadPreferences()
ui->resolutionSpinBox->setValue(settings.value("analysis/resolution", 65536).toInt());
double zoomX = settings.value("analysis/zoomX", 1.0).toDouble();
double zoomY = settings.value("analysis/zoomY", 1.0).toDouble();
if(zoomX != 1.0 || zoomY != 1.0)
if (zoomX != 1.0 || zoomY != 1.0)
analysisPlotScene->setZoom(zoomX, zoomY);
int scrollX = settings.value("analysis/scrollX", round(analysisPlotScene->hzToX(20))).toInt();
int scrollY = settings.value("analysis/scrollY", round(analysisPlotScene->dbToY(22))).toInt();
@@ -947,13 +947,13 @@ void MainWindow::loadPreferences()
QVariant openFilesValue = settings.value("openFiles");
int tabIndex = settings.value("tabIndex").toInt();
if(openFilesValue.isValid())
if (openFilesValue.isValid())
{
QStringList fileList = openFilesValue.toStringList();
for(int i = 0; i < fileList.size(); i++)
for (int i = 0; i < fileList.size(); i++)
{
load(fileList[i]);
if(i == tabIndex)
if (i == tabIndex)
tabIndex = ui->tabWidget->currentIndex();
}
}
@@ -963,18 +963,18 @@ void MainWindow::loadPreferences()
QVariant languageValue = settings.value("language");
QLocale::Language language;
if(languageValue.isValid())
if (languageValue.isValid())
language = QLocale(languageValue.toString()).language();
else
language = QLocale::AnyLanguage;
for(QAction* action : ui->menuLanguage->actions())
for (QAction* action : ui->menuLanguage->actions())
action->setChecked(action->data().toInt() == language);
}
void MainWindow::savePreferences()
{
if(noSavePreferences)
if (noSavePreferences)
return;
QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat);
@@ -995,13 +995,13 @@ void MainWindow::savePreferences()
settings.setValue("analysis/scrollY", value);
QStringList fileList;
for(int i = 0; i < ui->tabWidget->count(); i++)
for (int i = 0; i < ui->tabWidget->count(); i++)
{
QScrollArea* scrollArea = qobject_cast<QScrollArea*>(ui->tabWidget->widget(i));
if(scrollArea == NULL)
if (scrollArea == NULL)
continue;
FilterTable* filterTable = qobject_cast<FilterTable*>(scrollArea->widget());
if(filterTable->getConfigPath().length() > 0)
if (filterTable->getConfigPath().length() > 0)
{
fileList.append(filterTable->getConfigPath());
}
@@ -1017,17 +1017,17 @@ void MainWindow::updateRecentFiles()
{
QList<QAction*> actions = ui->menuFile->actions();
int separatorsFound = 0;
for(int i = actions.size() - 1; i >= 0; i--)
for (int i = actions.size() - 1; i >= 0; i--)
{
QAction* action = actions[i];
if(action->isSeparator())
if (action->isSeparator())
{
separatorsFound++;
if(separatorsFound == 1)
if (separatorsFound == 1)
{
QList<QAction*> newActions;
for(QString recentFile : recentFiles)
for (QString recentFile : recentFiles)
{
QAction* newAction = new QAction(recentFile, ui->menuFile);
connect(newAction, SIGNAL(triggered(bool)), this, SLOT(recentFileSelected()));
@@ -1040,7 +1040,7 @@ void MainWindow::updateRecentFiles()
break;
}
}
else if(separatorsFound >= 1)
else if (separatorsFound >= 1)
{
ui->menuFile->removeAction(action);
}
+15 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -44,7 +44,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QDir configDir, QWidget *parent = 0);
explicit MainWindow(QDir configDir, QWidget* parent = 0);
~MainWindow();
void doChecks();
void runConfigurator();
@@ -98,7 +98,7 @@ private:
void savePreferences();
void updateRecentFiles();
Ui::MainWindow *ui;
Ui::MainWindow* ui;
QDir configDir;
QCheckBox* instantModeCheckBox;
+57 -57
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _USE_MATH_DEFINES
@@ -30,8 +30,8 @@ static const double dialQSteps = 1000;
static const double dialQMin = 0.3333;
static const double dialQMax = 33.3333;
BiQuadFilterGUI::BiQuadFilterGUI(BiQuadFilter* filter) :
ui(new Ui::BiQuadFilterGUI)
BiQuadFilterGUI::BiQuadFilterGUI(BiQuadFilter* filter)
: ui(new Ui::BiQuadFilterGUI)
{
ui->setupUi(this);
@@ -46,22 +46,22 @@ BiQuadFilterGUI::BiQuadFilterGUI(BiQuadFilter* filter) :
BiQuad::Type type = filter->getType();
int typeIndex = ui->typeComboBox->findData(type);
if(typeIndex != -1)
if (typeIndex != -1)
ui->typeComboBox->setCurrentIndex(typeIndex);
if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF )
if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
ui->freqComboBox->setCurrentIndex(filter->getIsCornerFreq() ? 1 : 0);
ui->freqSpinBox->setValue(filter->getFreq());
if(type == BiQuad::PEAKING )
if (type == BiQuad::PEAKING)
ui->qComboBox->setCurrentIndex(filter->getIsBandwidth() ? 1 : 0);
else if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS)
else if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS)
ui->qComboBox->setCurrentIndex(filter->getBandwidthOrQOrS() == M_SQRT1_2 ? 0 : 1);
else if((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && !filter->getIsCornerFreq())
else if ((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && !filter->getIsCornerFreq())
ui->qComboBox->setCurrentIndex(filter->getBandwidthOrQOrS() == 0.9 ? 0 : 1);
if((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && filter->getBandwidthOrQOrS() != 0.9)
if ((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && filter->getBandwidthOrQOrS() != 0.9)
ui->qSpinBox->setValue(filter->getBandwidthOrQOrS() * 12.0);
else
ui->qSpinBox->setValue(filter->getBandwidthOrQOrS());
@@ -82,19 +82,19 @@ void BiQuadFilterGUI::store(QString& command, QString& parameters)
command = "Filter";
parameters = "ON ";
switch(type)
switch (type)
{
case BiQuad::PEAKING:
parameters += "PK";
break;
case BiQuad::LOW_PASS:
if(mode == 'F')
if (mode == 'F')
parameters += "LP";
else
parameters += "LPQ";
break;
case BiQuad::HIGH_PASS:
if(mode == 'F')
if (mode == 'F')
parameters += "HP";
else
parameters += "HPQ";
@@ -103,13 +103,13 @@ void BiQuadFilterGUI::store(QString& command, QString& parameters)
parameters += "BP";
break;
case BiQuad::LOW_SHELF:
if(freqMode == 'E' && mode == 'S')
if (freqMode == 'E' && mode == 'S')
parameters += "LSC";
else
parameters += "LS";
break;
case BiQuad::HIGH_SHELF:
if(freqMode == 'E' && mode == 'S')
if (freqMode == 'E' && mode == 'S')
parameters += "HSC";
else
parameters += "HS";
@@ -122,18 +122,18 @@ void BiQuadFilterGUI::store(QString& command, QString& parameters)
break;
}
if((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && mode == 'S')
if ((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && mode == 'S')
parameters += QString(" %1 dB").arg(ui->qSpinBox->value());
parameters += QString(" Fc %1 Hz").arg(ui->freqSpinBox->value());
if(type == BiQuad::PEAKING || type == BiQuad::LOW_SHELF
|| type == BiQuad::HIGH_SHELF)
if (type == BiQuad::PEAKING || type == BiQuad::LOW_SHELF
|| type == BiQuad::HIGH_SHELF)
parameters += QString(" Gain %1 dB").arg(ui->gainSpinBox->value());
if(mode == 'Q')
if (mode == 'Q')
parameters += QString(" Q %1").arg(ui->qSpinBox->value());
else if(mode == 'B')
else if (mode == 'B')
parameters += QString(" BW Oct %1").arg(ui->qSpinBox->value());
}
@@ -187,13 +187,13 @@ void BiQuadFilterGUI::on_typeComboBox_currentIndexChanged(int index)
QChar freqMode = ui->freqComboBox->currentData().toChar();
double freqValue = ui->freqSpinBox->value();
ui->freqComboBox->clear();
if(type == BiQuad::PEAKING || type == BiQuad::BAND_PASS || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF || type == BiQuad::NOTCH || type == BiQuad::ALL_PASS )
if (type == BiQuad::PEAKING || type == BiQuad::BAND_PASS || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF || type == BiQuad::NOTCH || type == BiQuad::ALL_PASS)
ui->freqComboBox->addItem(tr("Center frequency"), 'E');
if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
ui->freqComboBox->addItem(tr("Corner frequency"), 'O');
ui->freqComboBox->setEnabled(ui->freqComboBox->count() > 1);
int freqIndex = ui->freqComboBox->findData(freqMode);
if(freqIndex != -1 && sameTypeCategory)
if (freqIndex != -1 && sameTypeCategory)
{
ui->freqComboBox->setCurrentIndex(freqIndex);
ui->freqSpinBox->setValue(freqValue);
@@ -206,30 +206,30 @@ void BiQuadFilterGUI::on_typeComboBox_currentIndexChanged(int index)
QChar mode = ui->qComboBox->currentData().toChar();
double qValue = ui->qSpinBox->value();
ui->qComboBox->clear();
if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS || type == BiQuad::NOTCH )
if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS || type == BiQuad::NOTCH)
ui->qComboBox->addItem(tr("Fixed Q"), 'F');
else if((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && freqMode == 'E')
else if ((type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF) && freqMode == 'E')
ui->qComboBox->addItem(tr("Fixed S"), 'F');
if(type == BiQuad::PEAKING || type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::ALL_PASS || type == BiQuad::BAND_PASS || type == BiQuad::NOTCH)
if (type == BiQuad::PEAKING || type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::ALL_PASS || type == BiQuad::BAND_PASS || type == BiQuad::NOTCH)
ui->qComboBox->addItem(tr("Q factor"), 'Q');
if(type == BiQuad::PEAKING)
if (type == BiQuad::PEAKING)
ui->qComboBox->addItem(tr("Bandwidth"), 'B');
if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
ui->qComboBox->addItem(tr("Slope"), 'S');
ui->qComboBox->setEnabled(ui->qComboBox->count() > 1);
int qIndex = ui->qComboBox->findData(mode);
if(qIndex != -1 && sameTypeCategory)
if (qIndex != -1 && sameTypeCategory)
{
ui->qComboBox->setCurrentIndex(qIndex);
ui->qSpinBox->setValue(qValue);
}
else if(type == BiQuad::PEAKING || type == BiQuad::ALL_PASS)
else if (type == BiQuad::PEAKING || type == BiQuad::ALL_PASS)
{
ui->qSpinBox->setValue(10);
}
bool gainVisible = type == BiQuad::PEAKING || type == BiQuad::LOW_SHELF
|| type == BiQuad::HIGH_SHELF;
|| type == BiQuad::HIGH_SHELF;
ui->gainDial->setVisible(gainVisible);
ui->gainLabel->setVisible(gainVisible);
ui->gainSpinBox->setVisible(gainVisible);
@@ -243,17 +243,17 @@ void BiQuadFilterGUI::on_freqComboBox_currentIndexChanged(int index)
{
BiQuad::Type type = (BiQuad::Type)ui->typeComboBox->currentData().toInt();
QChar freqMode = ui->freqComboBox->itemData(index).toChar();
if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
{
QChar mode = ui->qComboBox->currentData().toChar();
double qValue = ui->qSpinBox->value();
ui->qComboBox->clear();
if(freqMode == 'E')
if (freqMode == 'E')
ui->qComboBox->addItem(tr("Fixed S"), 'F');
ui->qComboBox->addItem(tr("Slope"), 'S');
ui->qComboBox->setEnabled(ui->qComboBox->count() > 1);
int qIndex = ui->qComboBox->findData(mode);
if(qIndex != -1)
if (qIndex != -1)
{
ui->qComboBox->setCurrentIndex(qIndex);
ui->qSpinBox->setValue(qValue);
@@ -261,7 +261,7 @@ void BiQuadFilterGUI::on_freqComboBox_currentIndexChanged(int index)
double centerFreqFactor = pow(10.0, abs(ui->gainSpinBox->value()) / 80.0 / (ui->qSpinBox->value() / 12.0));
double freq = ui->freqSpinBox->value();
if((freqMode == 'E') == (type == BiQuad::LOW_SHELF) )
if ((freqMode == 'E') == (type == BiQuad::LOW_SHELF))
freq *= centerFreqFactor;
else
freq /= centerFreqFactor;
@@ -272,27 +272,27 @@ void BiQuadFilterGUI::on_freqComboBox_currentIndexChanged(int index)
void BiQuadFilterGUI::on_qComboBox_currentIndexChanged(int index)
{
QChar mode = ui->qComboBox->currentData().toChar();
if(mode == 'F' || mode == 'Q')
if (mode == 'F' || mode == 'Q')
ui->qSpinBox->setSuffix("");
else if(mode == 'B')
else if (mode == 'B')
ui->qSpinBox->setSuffix(" Oct");
else if(mode == 'S')
else if (mode == 'S')
ui->qSpinBox->setSuffix(" dB/Oct");
ui->qDial->setEnabled(mode != 'F');
ui->qSpinBox->setEnabled(mode != 'F');
if(mode == 'F')
if (mode == 'F')
{
BiQuad::Type type = (BiQuad::Type)ui->typeComboBox->currentData().toInt();
if(type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS)
if (type == BiQuad::LOW_PASS || type == BiQuad::HIGH_PASS || type == BiQuad::BAND_PASS)
ui->qSpinBox->setValue(M_SQRT1_2);
else if(type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
else if (type == BiQuad::LOW_SHELF || type == BiQuad::HIGH_SHELF)
ui->qSpinBox->setValue(0.9);
else if(type == BiQuad::NOTCH)
else if (type == BiQuad::NOTCH)
ui->qSpinBox->setValue(30);
}
else if(qIsBw && mode == 'Q')
else if (qIsBw && mode == 'Q')
{
double n = ui->qSpinBox->value();
double p2n = pow(2.0, n);
@@ -300,14 +300,14 @@ void BiQuadFilterGUI::on_qComboBox_currentIndexChanged(int index)
ui->qSpinBox->setValue(q);
qIsBw = false;
}
else if(!qIsBw && mode == 'B')
else if (!qIsBw && mode == 'B')
{
double q = ui->qSpinBox->value();
double n = 2.0 / M_LN2 * asinh(1.0 / (2.0 * q));
ui->qSpinBox->setValue(n);
qIsBw = true;
}
else if(mode == 'S')
else if (mode == 'S')
{
ui->qSpinBox->setValue(12.0);
}
@@ -317,7 +317,7 @@ void BiQuadFilterGUI::on_qComboBox_currentIndexChanged(int index)
int BiQuadFilterGUI::getTypeCategory(BiQuad::Type type)
{
switch(type)
switch (type)
{
case BiQuad::PEAKING:
return 0;
+14 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -22,8 +22,7 @@
#include "Editor/IFilterGUI.h"
#include <filters/BiQuadFilter.h>
namespace Ui
{
namespace Ui {
class BiQuadFilterGUI;
}
+16 -16
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "BiQuadFilterGUI.h"
@@ -43,17 +43,17 @@ IFilterGUI* BiQuadFilterGUIFactory::createFilterGUI(QString& command, QString& p
{
BiQuadFilterGUI* result = NULL;
if(command.startsWith("Filter"))
if (command.startsWith("Filter"))
{
BiQuadFilterFactory factory;
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
if(!filters.empty())
if (!filters.empty())
{
BiQuadFilter* filter = (BiQuadFilter*)filters[0];
result = new BiQuadFilterGUI(filter);
}
for(IFilter* f : filters)
for (IFilter* f : filters)
{
f->~IFilter();
MemoryHelper::free(f);
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+18 -18
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "ChannelFilterGUI.h"
@@ -23,8 +23,8 @@
using namespace std;
ChannelFilterGUI::ChannelFilterGUI(const QString& parameters, int selectedChannelMask) :
ui(new Ui::ChannelFilterGUI)
ChannelFilterGUI::ChannelFilterGUI(const QString& parameters, int selectedChannelMask)
: ui(new Ui::ChannelFilterGUI)
{
ui->setupUi(this);
@@ -38,8 +38,8 @@ ChannelFilterGUI::ChannelFilterGUI(const QString& parameters, int selectedChanne
selectedChannels.clear();
QStringList words = parameters.trimmed().split(' ', QString::SkipEmptyParts);
for(QString word : words)
if(word.length() > 0)
for (QString word : words)
if (word.length() > 0)
selectedChannels.append(word.toUpper());
}
@@ -66,7 +66,7 @@ void ChannelFilterGUI::store(QString& command, QString& parameters)
void ChannelFilterGUI::on_pushButton_clicked()
{
ChannelFilterGUIDialog dialog(this, selectedChannels, selectedChannelMask, channelNames);
if(dialog.exec() == QDialog::Accepted)
if (dialog.exec() == QDialog::Accepted)
{
selectedChannels = dialog.getSelectedChannels();
refreshGui();
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -43,7 +43,7 @@ private slots:
private:
void refreshGui();
Ui::ChannelFilterGUI *ui;
Ui::ChannelFilterGUI* ui;
QStringList selectedChannels;
int selectedChannelMask;
std::vector<std::wstring> channelNames;
+16 -16
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QPainter>
@@ -22,8 +22,8 @@
#include "ChannelFilterGUIScene.h"
#include "ChannelFilterGUIChannelItem.h"
ChannelFilterGUIChannelItem::ChannelFilterGUIChannelItem(const QString& name) :
ChannelGraphItem(name)
ChannelFilterGUIChannelItem::ChannelFilterGUIChannelItem(const QString& name)
: ChannelGraphItem(name)
{
setFlag(ItemIsSelectable);
}
@@ -32,7 +32,7 @@ void ChannelFilterGUIChannelItem::paint(QPainter* painter, const QStyleOptionGra
{
QColor color;
if(isSelected())
if (isSelected())
{
color = QColor(176, 229, 255);
}
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -26,7 +26,7 @@ class ChannelFilterGUIChannelItem : public ChannelGraphItem
public:
ChannelFilterGUIChannelItem(const QString& name);
enum { Type = UserType + 2 };
enum {Type = UserType + 2};
virtual int type() const
{
return Type;
+29 -29
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
@@ -30,8 +30,8 @@
using namespace std;
ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget *parent, QStringList selectedChannels, int selectedChannelMask, const vector<wstring>& channelNames) :
QDialog(parent),
ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget* parent, QStringList selectedChannels, int selectedChannelMask, const vector<wstring>& channelNames)
: QDialog(parent),
ui(new Ui::ChannelFilterGUIDialog)
{
ui->setupUi(this);
@@ -68,26 +68,26 @@ ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget *parent, QStringList sele
vector<wstring> remainingChannelNames = channelNames;
QStringList remainingSelectedChannels = selectedChannels;
if(selectedChannels.contains("ALL"))
if (selectedChannels.contains("ALL"))
{
ui->allChannelsCheckBox->setChecked(true);
remainingSelectedChannels.clear();
}
int channelIndex = 0;
for(QCheckBox* checkBox : checkBoxes)
for (QCheckBox* checkBox : checkBoxes)
{
int channelPos = checkBox->property(PROPERTY_POSITION).toInt();
QString channelName = checkBox->property(PROPERTY_NAME).toString();
bool exists = selectedChannelMask & channelPos;
checkBox->setVisible(exists);
if(exists)
if (exists)
{
channelIndex++;
bool checked = false;
remainingChannelNames.erase(remove(remainingChannelNames.begin(), remainingChannelNames.end(), channelName.toStdWString()), remainingChannelNames.end());
if(remainingSelectedChannels.removeOne(channelName))
if (remainingSelectedChannels.removeOne(channelName))
checked = true;
if(remainingSelectedChannels.removeOne(QString(channelIndex)))
if (remainingSelectedChannels.removeOne(QString(channelIndex)))
checked = true;
checkBox->setChecked(checked);
}
@@ -98,18 +98,18 @@ ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget *parent, QStringList sele
}
ui->listWidget->clear();
for(wstring channelName : remainingChannelNames)
for (wstring channelName : remainingChannelNames)
{
QListWidgetItem* item = new QListWidgetItem(QString::fromStdWString(channelName));
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
if(remainingSelectedChannels.removeOne(QString::fromStdWString(channelName)))
if (remainingSelectedChannels.removeOne(QString::fromStdWString(channelName)))
item->setCheckState(Qt::Checked);
else
item->setCheckState(Qt::Unchecked);
ui->listWidget->addItem(item);
}
for(QString c : remainingSelectedChannels)
for (QString c : remainingSelectedChannels)
{
QListWidgetItem* item = new QListWidgetItem(c);
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
@@ -143,28 +143,28 @@ QStringList ChannelFilterGUIDialog::getSelectedChannels() const
{
QStringList selectedChannels;
if(ui->allChannelsCheckBox->isChecked())
if (ui->allChannelsCheckBox->isChecked())
{
selectedChannels.append("ALL");
}
else
{
for(QCheckBox* checkBox : checkBoxes)
for (QCheckBox* checkBox : checkBoxes)
{
if(checkBox->isChecked())
if (checkBox->isChecked())
{
QString channelName = checkBox->property(PROPERTY_NAME).toString();
selectedChannels.append(channelName);
}
}
for(int i = 0; i < ui->listWidget->count(); i++)
for (int i = 0; i < ui->listWidget->count(); i++)
{
QListWidgetItem* item = ui->listWidget->item(i);
if(item->checkState() == Qt::Checked)
if (item->checkState() == Qt::Checked)
{
QString text = item->text().trimmed();
if(text.length() > 0)
if (text.length() > 0)
selectedChannels.append(text.toUpper());
}
}
+15 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -31,7 +31,7 @@ class ChannelFilterGUIDialog : public QDialog
Q_OBJECT
public:
explicit ChannelFilterGUIDialog(QWidget *parent, QStringList selectedChannels, int selectedChannelMask, const std::vector<std::wstring>& channelNames);
explicit ChannelFilterGUIDialog(QWidget* parent, QStringList selectedChannels, int selectedChannelMask, const std::vector<std::wstring>& channelNames);
~ChannelFilterGUIDialog();
QStringList getSelectedChannels() const;
@@ -44,6 +44,6 @@ private slots:
void on_allChannelsCheckBox_toggled(bool checked);
private:
Ui::ChannelFilterGUIDialog *ui;
Ui::ChannelFilterGUIDialog* ui;
QList<QCheckBox*> checkBoxes;
};
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "Editor/FilterTable.h"
@@ -41,7 +41,7 @@ IFilterGUI* ChannelFilterGUIFactory::createFilterGUI(QString& command, QString&
{
ChannelFilterGUI* result = NULL;
if(command == "Channel")
if (command == "Channel")
{
result = new ChannelFilterGUI(parameters, filterTable->getSelectedChannelMask());
}
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+20 -20
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "ChannelFilterGUIChannelItem.h"
@@ -37,7 +37,7 @@ void ChannelFilterGUIScene::load(vector<wstring> channelNames, QStringList selec
channelNames.push_back(L"ALL");
for(unsigned i = 0; i < channelNames.size(); i++)
for (unsigned i = 0; i < channelNames.size(); i++)
{
QString c = QString::fromStdWString(channelNames[i]);
@@ -46,15 +46,15 @@ void ChannelFilterGUIScene::load(vector<wstring> channelNames, QStringList selec
addItem(item);
channelMap.insert(c, item);
if(c != "ALL")
if (c != "ALL")
channelMap.insert(QString().setNum(i), item);
lastItem = item;
}
for(QString c : selectedChannels)
for (QString c : selectedChannels)
{
ChannelFilterGUIChannelItem* item = channelMap.value(c.toUpper());
if(item == NULL)
if (item == NULL)
{
item = new ChannelFilterGUIChannelItem(c);
item->setPos(getNextChannelPoint(lastItem, false));
@@ -74,12 +74,12 @@ QStringList ChannelFilterGUIScene::getSelectedChannels()
{
QStringList selectedChannels;
for(QGraphicsItem* item : items(Qt::AscendingOrder))
for (QGraphicsItem* item : items(Qt::AscendingOrder))
{
ChannelFilterGUIChannelItem* channelItem = qgraphicsitem_cast<ChannelFilterGUIChannelItem*>(item);
if(channelItem != NULL)
if (channelItem != NULL)
{
if(channelItem->isSelected())
if (channelItem->isSelected())
selectedChannels.append(channelItem->getName());
}
}
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+15 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "CommentFilterGUI.h"
@@ -49,7 +49,7 @@ CommentFilterGUI::~CommentFilterGUI()
void CommentFilterGUI::configureChannels(vector<wstring>& channelNames)
{
if(ui->actionPowerOn->isChecked())
if (ui->actionPowerOn->isChecked())
{
child->configureChannels(channelNames);
}
@@ -65,7 +65,7 @@ void CommentFilterGUI::store(QString& command, QString& parameters)
{
child->store(command, parameters);
if(!ui->actionPowerOn->isChecked())
if (!ui->actionPowerOn->isChecked())
command = "# " + command;
}
+14 -15
View File
@@ -1,28 +1,27 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "Editor/IFilterGUI.h"
namespace Ui
{
namespace Ui {
class CommentFilterGUI;
}
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "helpers/StringHelper.h"
@@ -37,7 +37,7 @@ QList<FilterTemplate> CommentFilterGUIFactory::createFilterTemplates()
IFilterGUI* CommentFilterGUIFactory::createFilterGUI(QString& command, QString& parameters)
{
lastWasComment = command.length() > 0 && command[0] == '#';
if(lastWasComment)
if (lastWasComment)
command = command.mid(1).trimmed();
return NULL;
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+23 -23
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QFileDialog>
@@ -24,8 +24,8 @@
#include "ConvolutionFilterGUI.h"
#include "ui_ConvolutionFilterGUI.h"
ConvolutionFilterGUI::ConvolutionFilterGUI(const QString& configPath, unsigned deviceSampleRate, const QString& path) :
ui(new Ui::ConvolutionFilterGUI), deviceSampleRate(deviceSampleRate)
ConvolutionFilterGUI::ConvolutionFilterGUI(const QString& configPath, unsigned deviceSampleRate, const QString& path)
: ui(new Ui::ConvolutionFilterGUI), deviceSampleRate(deviceSampleRate)
{
ui->setupUi(this);
@@ -51,19 +51,19 @@ void ConvolutionFilterGUI::on_selectFileToolButton_clicked()
QFileInfo fileInfo(configPath);
QDir configDir = fileInfo.absoluteDir();
QString path = ui->pathLineEdit->text();
if(path.length() > 0)
if (path.length() > 0)
fileInfo.setFile(configDir, path);
QFileDialog dialog(this, tr("Select impulse response file"), fileInfo.absolutePath(), "*.wav;*.flac;*.ogg");
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("Impulse response (*.wav *.flac *.ogg)"));
if(path.length() > 0)
if (path.length() > 0)
dialog.selectFile(fileInfo.fileName());
if(dialog.exec() == QDialog::Accepted)
if (dialog.exec() == QDialog::Accepted)
{
QString absolutePath = dialog.selectedFiles().first();
QString relativePath = configDir.relativeFilePath(absolutePath);
if(relativePath.startsWith("../../"))
if (relativePath.startsWith("../../"))
relativePath = absolutePath;
ui->pathLineEdit->setText(QDir::toNativeSeparators(relativePath));
updateFileInfo();
@@ -85,7 +85,7 @@ void ConvolutionFilterGUI::updateFileInfo()
QString error = "";
QString path = ui->pathLineEdit->text();
if(path.length() == 0)
if (path.length() == 0)
{
error = tr("No file selected");
labelsVisible = false;
@@ -95,7 +95,7 @@ void ConvolutionFilterGUI::updateFileInfo()
QFileInfo fileInfo(configPath);
QDir configDir = fileInfo.absoluteDir();
fileInfo.setFile(configDir, path);
if(!fileInfo.exists())
if (!fileInfo.exists())
{
error = tr("File not found");
labelsVisible = false;
@@ -106,7 +106,7 @@ void ConvolutionFilterGUI::updateFileInfo()
SF_INFO info;
SNDFILE* file = sf_wchar_open(path.toStdWString().c_str(), SFM_READ, &info);
if(file == NULL)
if (file == NULL)
{
error = tr("Unsupported file format");
labelsVisible = false;
@@ -120,7 +120,7 @@ void ConvolutionFilterGUI::updateFileInfo()
ui->labelSampleRateValue->setText(tr("%0 Hz").arg(sampleRate));
sf_close(file);
if(sampleRate != deviceSampleRate)
if (sampleRate != deviceSampleRate)
{
error = tr("The file sample rate does not match the device sample rate (%0 Hz)!\nSelect a different file or change the device configuration.").arg(deviceSampleRate);
}
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -43,7 +43,7 @@ private slots:
private:
void updateFileInfo();
Ui::ConvolutionFilterGUI *ui;
Ui::ConvolutionFilterGUI* ui;
QString configPath;
unsigned deviceSampleRate;
};
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "DeviceAPOInfo.h"
@@ -47,7 +47,7 @@ IFilterGUI* ConvolutionFilterGUIFactory::createFilterGUI(QString& command, QStri
{
ConvolutionFilterGUI* result = NULL;
if(command == "Convolution")
if (command == "Convolution")
{
result = new ConvolutionFilterGUI(configPath, deviceSampleRate, parameters.trimmed());
}
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+39 -39
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "Editor/widgets/ResizeCorner.h"
@@ -27,8 +27,8 @@ static const int DEFAULT_HEIGHT = 88;
using namespace std;
CopyFilterGUI::CopyFilterGUI(CopyFilter* filter, FilterTable* filterTable) :
ui(new Ui::CopyFilterGUI)
CopyFilterGUI::CopyFilterGUI(CopyFilter* filter, FilterTable* filterTable)
: ui(new Ui::CopyFilterGUI)
{
ui->setupUi(this);
@@ -40,10 +40,10 @@ CopyFilterGUI::CopyFilterGUI(CopyFilter* filter, FilterTable* filterTable) :
ResizeCorner* cornerWidget = new ResizeCorner(filterTable,
QSize(0, 50), QSize(0, INT_MAX),
[this]() {
[this]() {
return QSize(0, ui->scrollArea->height());
},
[this](QSize size) {
[this](QSize size) {
ui->scrollArea->setFixedHeight(size.height());
}, ui->scrollArea);
cornerWidget->setCursor(Qt::SizeVerCursor);
@@ -66,7 +66,7 @@ void CopyFilterGUI::configureChannels(vector<wstring>& channelNames)
{
vector<Assignment> assignments = ui->form->buildAssignments();
if(channelNames != inputChannelNames)
if (channelNames != inputChannelNames)
{
inputChannelNames = channelNames;
@@ -74,24 +74,24 @@ void CopyFilterGUI::configureChannels(vector<wstring>& channelNames)
ui->form->setChannelNames(channelNames);
}
for(Assignment assignment : assignments)
for (Assignment assignment : assignments)
{
if(assignment.targetChannel == L"")
if (assignment.targetChannel == L"")
continue;
bool hasSummand = false;
for(Assignment::Summand summand : assignment.sourceSum)
for (Assignment::Summand summand : assignment.sourceSum)
{
if(summand.channel != L" ")
if (summand.channel != L" ")
{
hasSummand = true;
break;
}
}
if(!hasSummand)
if (!hasSummand)
continue;
int channelIndex = ChannelHelper::getChannelIndex(assignment.targetChannel, channelNames, true);
if(channelIndex == -1)
if (channelIndex == -1)
channelNames.push_back(assignment.targetChannel);
}
}
@@ -102,29 +102,29 @@ void CopyFilterGUI::store(QString& command, QString& parameters)
std::vector<Assignment> assignments;
if(ui->tabWidget->currentIndex() == 0)
if (ui->tabWidget->currentIndex() == 0)
assignments = scene->buildAssignments();
else
assignments = ui->form->buildAssignments();
bool firstAssignment = true;
for(const Assignment& assignment : assignments)
for (const Assignment& assignment : assignments)
{
if(assignment.targetChannel == L"")
if (assignment.targetChannel == L"")
continue;
bool firstSummand = true;
for(const Assignment::Summand& summand : assignment.sourceSum)
for (const Assignment::Summand& summand : assignment.sourceSum)
{
// skip not yet filled row
if(summand.channel == L" ")
if (summand.channel == L" ")
continue;
if(firstSummand)
if (firstSummand)
{
firstSummand = false;
if(firstAssignment)
if (firstAssignment)
firstAssignment = false;
else
parameters += " ";
@@ -140,25 +140,25 @@ void CopyFilterGUI::store(QString& command, QString& parameters)
bool hasChannel = summand.channel != L"";
bool hasFactor = !hasChannel || summand.factor != 1.0 || summand.isDecibel;
if(hasFactor)
if (hasFactor)
{
QString factorString;
factorString.setNum(summand.factor);
if(factorString != "0" && !factorString.contains('.'))
if (factorString != "0" && !factorString.contains('.'))
factorString += ".0";
parameters += factorString;
if(summand.isDecibel)
if (summand.isDecibel)
parameters += "dB";
}
if(hasFactor && hasChannel)
if (hasFactor && hasChannel)
parameters += "*";
if(hasChannel)
if (hasChannel)
parameters += QString::fromStdWString(summand.channel);
}
if(ui->tabWidget->currentIndex() == 0)
if (ui->tabWidget->currentIndex() == 0)
ui->form->load(assignments);
else
scene->load(inputChannelNames, assignments);
@@ -173,8 +173,8 @@ void CopyFilterGUI::loadPreferences(const QVariantMap& prefs)
void CopyFilterGUI::storePreferences(QVariantMap& prefs)
{
if(ui->scrollArea->height() != DEFAULT_HEIGHT)
if (ui->scrollArea->height() != DEFAULT_HEIGHT)
prefs.insert("height", ui->scrollArea->height());
if(ui->tabWidget->currentIndex() != 0)
if (ui->tabWidget->currentIndex() != 0)
prefs.insert("tabIndex", ui->tabWidget->currentIndex());
}
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -44,7 +44,7 @@ public:
void storePreferences(QVariantMap& prefs) override;
private:
Ui::CopyFilterGUI *ui;
Ui::CopyFilterGUI* ui;
CopyFilterGUIScene* scene;
std::vector<std::wstring> inputChannelNames;
+35 -35
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QGraphicsScene>
@@ -22,8 +22,8 @@
#include "CopyFilterGUIScene.h"
#include "CopyFilterGUIChannelItem.h"
CopyFilterGUIChannelItem::CopyFilterGUIChannelItem(const QString& name, bool output) :
ChannelGraphItem(name), output(output)
CopyFilterGUIChannelItem::CopyFilterGUIChannelItem(const QString& name, bool output)
: ChannelGraphItem(name), output(output)
{
setZValue(-1);
}
@@ -31,19 +31,19 @@ CopyFilterGUIChannelItem::CopyFilterGUIChannelItem(const QString& name, bool out
void CopyFilterGUIChannelItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
QColor color;
if(output)
if (output)
color = QColor(255, 194, 194);
else
color = QColor(176, 255, 176);
ChannelGraphItem::paint(painter, color) ;
ChannelGraphItem::paint(painter, color);
}
QPointF CopyFilterGUIChannelItem::getPerimeterPointTo(QPointF oppositePoint)
{
QRectF rect = boundingRect();
if(output)
if (output)
return scenePos() + QPointF(rect.center().x(), rect.top());
else
return scenePos() + QPointF(rect.center().x(), rect.top() + rect.height());
@@ -54,10 +54,10 @@ CopyFilterGUIChannelItem* CopyFilterGUIChannelItem::findAt(QPointF mousePos)
CopyFilterGUIChannelItem* result = NULL;
QList<QGraphicsItem*> items = scene()->items(mousePos);
for(QGraphicsItem* item : items)
for (QGraphicsItem* item : items)
{
CopyFilterGUIChannelItem* channelItem = qgraphicsitem_cast<CopyFilterGUIChannelItem*>(item);
if(channelItem != NULL && channelItem->output != output)
if (channelItem != NULL && channelItem->output != output)
{
result = channelItem;
break;
@@ -74,7 +74,7 @@ QLineF CopyFilterGUIChannelItem::getLineTo(CopyFilterGUIChannelItem* item)
QPointF startPoint = getPerimeterPointTo(endPoint);
QLineF line;
if(output)
if (output)
line = QLineF(endPoint, startPoint);
else
line = QLineF(startPoint, endPoint);
@@ -88,23 +88,23 @@ void CopyFilterGUIChannelItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
void CopyFilterGUIChannelItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
if(currentConnection == NULL)
if (currentConnection == NULL)
{
if( !boundingRect().contains(event->pos()))
if (!boundingRect().contains(event->pos()))
{
currentConnection = new CopyFilterGUIConnectionItem();
scene()->addItem(currentConnection);
}
}
if(currentConnection != NULL)
if (currentConnection != NULL)
{
CopyFilterGUIChannelItem* item = findAt(event->scenePos());
if(item == NULL)
if (item == NULL)
{
QLineF line;
if(output)
if (output)
line = QLineF(event->scenePos(), getPerimeterPointTo(event->scenePos()));
else
line = QLineF(getPerimeterPointTo(event->scenePos()), event->scenePos());
@@ -119,14 +119,14 @@ void CopyFilterGUIChannelItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
void CopyFilterGUIChannelItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{
if(currentConnection != NULL)
if (currentConnection != NULL)
{
CopyFilterGUIChannelItem* item = findAt(event->scenePos());
if(item != NULL)
if (item != NULL)
{
CopyFilterGUIChannelItem* source;
CopyFilterGUIChannelItem* target;
if(output)
if (output)
{
source = item;
target = this;
@@ -138,13 +138,13 @@ void CopyFilterGUIChannelItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event
}
double factor = 1.0;
if(source->getName() == "")
if (source->getName() == "")
factor = 0.0;
scene()->addItem(new CopyFilterGUIConnectionItem(source, target, factor, false));
emit ((CopyFilterGUIScene*)scene())->updateModel();
emit ((CopyFilterGUIScene*)scene())->updateChannels();
emit((CopyFilterGUIScene*)scene())->updateModel();
emit((CopyFilterGUIScene*)scene())->updateChannels();
}
scene()->removeItem(currentConnection);
@@ -155,12 +155,12 @@ void CopyFilterGUIChannelItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event
{
scene()->clearSelection();
QList<QGraphicsItem*> items = scene()->items();
for(QGraphicsItem* item : items)
for (QGraphicsItem* item : items)
{
CopyFilterGUIConnectionItem* connItem = qgraphicsitem_cast<CopyFilterGUIConnectionItem*>(item);
if(connItem != NULL)
if (connItem != NULL)
{
if(connItem->getSource() == this || connItem->getTarget() == this)
if (connItem->getSource() == this || connItem->getTarget() == this)
connItem->setSelected(true);
}
}
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -30,7 +30,7 @@ class CopyFilterGUIChannelItem : public ChannelGraphItem
public:
CopyFilterGUIChannelItem(const QString& name, bool output);
enum { Type = UserType + 2 };
enum {Type = UserType + 2};
virtual int type() const
{
return Type;
+25 -25
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QGraphicsScene>
@@ -64,7 +64,7 @@ QPainterPath CopyFilterGUIConnectionItem::shape() const
QPainterPath path;
path.setFillRule(Qt::WindingFill);
double length = line().length();
if(length > 0)
if (length > 0)
{
double offset = min(length, maxArrowSize);
QLineF unit = l.unitVector();
@@ -89,13 +89,13 @@ QPainterPath CopyFilterGUIConnectionItem::shape() const
polygon2.append(p1 + 3 * n);
path.addPolygon(polygon2);
if(factor != 1.0 || isDecibel)
if (factor != 1.0 || isDecibel)
{
QFont font;
font.setPixelSize(10);
QPointF center = (l.p1() + l.p2()) / 2;
QString text = QString("%1").arg(factor);
if(isDecibel)
if (isDecibel)
text += " dB";
QFontMetrics fontMetrics(font);
@@ -119,10 +119,10 @@ bool CopyFilterGUIConnectionItem::contains(const QPointF& point) const
void CopyFilterGUIConnectionItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
QLineF l = line();
if(!l.isNull())
if (!l.isNull())
{
painter->setBrush(Qt::black);
if(isSelected())
if (isSelected())
{
painter->setBrush(Qt::blue);
painter->setPen(QPen(Qt::blue, 1.5));
@@ -146,14 +146,14 @@ void CopyFilterGUIConnectionItem::paint(QPainter* painter, const QStyleOptionGra
painter->drawPolygon(polygon);
if(factor != 1.0 || isDecibel)
if (factor != 1.0 || isDecibel)
{
QFont font = painter->font();
font.setPixelSize(10);
painter->setFont(font);
QPointF center = (l.p1() + l.p2()) / 2;
QString text = QString("%1").arg(factor);
if(isDecibel)
if (isDecibel)
text += " dB";
QSizeF size = painter->fontMetrics().size(0, text);
@@ -171,7 +171,7 @@ void CopyFilterGUIConnectionItem::paint(QPainter* painter, const QStyleOptionGra
void CopyFilterGUIConnectionItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
{
QString text = QString("%1").arg(factor);
if(isDecibel)
if (isDecibel)
text += " dB";
ResizingLineEdit* lineEdit = new ResizingLineEdit("");
@@ -199,7 +199,7 @@ void CopyFilterGUIConnectionItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* even
QVariant CopyFilterGUIConnectionItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value)
{
if(change == ItemSelectedHasChanged)
if (change == ItemSelectedHasChanged)
{
setZValue(isSelected() ? 1 : 0);
}
@@ -211,7 +211,7 @@ void CopyFilterGUIConnectionItem::lineEditEditingFinished()
{
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(QObject::sender());
// might be called twice
if(!lineEdit->isVisible())
if (!lineEdit->isVisible())
return;
QString text = lineEdit->text();
@@ -220,7 +220,7 @@ void CopyFilterGUIConnectionItem::lineEditEditingFinished()
int lengthBefore = text.length();
text.replace("db", "", Qt::CaseInsensitive);
double value = text.toDouble(&ok);
if(ok)
if (ok)
{
factor = value;
isDecibel = text.length() < lengthBefore;
@@ -229,7 +229,7 @@ void CopyFilterGUIConnectionItem::lineEditEditingFinished()
lineEdit->setVisible(false);
lineEdit->deleteLater();
emit ((CopyFilterGUIScene*)scene())->updateModel();
emit((CopyFilterGUIScene*)scene())->updateModel();
}
CopyFilterGUIChannelItem* CopyFilterGUIConnectionItem::getSource() const
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -31,7 +31,7 @@ public:
CopyFilterGUIConnectionItem();
CopyFilterGUIConnectionItem(CopyFilterGUIChannelItem* source, CopyFilterGUIChannelItem* target, double factor, bool isDecibel);
enum { Type = UserType + 1 };
enum {Type = UserType + 1};
virtual int type() const
{
return Type;
+16 -16
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "filters/CopyFilter.h"
@@ -42,17 +42,17 @@ IFilterGUI* CopyFilterGUIFactory::createFilterGUI(QString& command, QString& par
{
CopyFilterGUI* result = NULL;
if(command == "Copy")
if (command == "Copy")
{
CopyFilterFactory factory;
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
if(!filters.empty())
if (!filters.empty())
{
CopyFilter* filter = (CopyFilter*)filters[0];
result = new CopyFilterGUI(filter, filterTable);
}
for(IFilter* f : filters)
for (IFilter* f : filters)
{
f->~IFilter();
MemoryHelper::free(f);
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+33 -33
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
@@ -29,20 +29,20 @@
using namespace std;
CopyFilterGUIForm::CopyFilterGUIForm(QWidget *parent) :
QWidget(parent)
CopyFilterGUIForm::CopyFilterGUIForm(QWidget* parent)
: QWidget(parent)
{
}
void CopyFilterGUIForm::load(vector<Assignment> assignments)
{
if(gridLayout != NULL)
if (gridLayout != NULL)
delete gridLayout;
for(QObject* object : children())
for (QObject* object : children())
{
QWidget* widget = qobject_cast<QWidget*>(object);
if(widget != NULL)
if (widget != NULL)
widget->setVisible(false);
object->deleteLater();
}
@@ -55,20 +55,20 @@ void CopyFilterGUIForm::load(vector<Assignment> assignments)
gridLayout->setColumnStretch(5, 1);
int row = 0;
for(Assignment assignment : assignments)
for (Assignment assignment : assignments)
{
QString oc = QString::fromStdWString(assignment.targetChannel);
bool firstSummand = true;
for(Assignment::Summand summand : assignment.sourceSum)
for (Assignment::Summand summand : assignment.sourceSum)
{
if(firstSummand)
if (firstSummand)
{
gridLayout->addWidget(new QLabel(tr("Channel"), this), row, 0);
QComboBox* targetComboBox = new QComboBox(this);
targetComboBox->setEditable(true);
for(wstring channelName : inputChannelNames)
for (wstring channelName : inputChannelNames)
targetComboBox->addItem(QString::fromStdWString(channelName));
targetComboBox->setEditText(oc);
connect(targetComboBox, SIGNAL(editTextChanged(QString)), this, SIGNAL(updateModel()));
@@ -96,7 +96,7 @@ void CopyFilterGUIForm::load(vector<Assignment> assignments)
connect(addSummandButton, SIGNAL(pressed()), this, SLOT(addSummand()));
QPushButton* removeButton = new QPushButton(this);
if(assignment.sourceSum.size() == 1)
if (assignment.sourceSum.size() == 1)
removeButton->setText(tr("Remove assignment"));
else
removeButton->setText(tr("Remove summand"));
@@ -122,16 +122,16 @@ void CopyFilterGUIForm::setChannelNames(const vector<wstring>& channelNames)
{
inputChannelNames = channelNames;
for(int row = 0; row < gridLayout->rowCount() - 1; row++)
for (int row = 0; row < gridLayout->rowCount() - 1; row++)
{
QLayoutItem* item = gridLayout->itemAtPosition(row, 1);
if(item != NULL)
if (item != NULL)
{
QComboBox* targetComboBox = qobject_cast<QComboBox*>(item->widget());
targetComboBox->blockSignals(true);
QString text = targetComboBox->currentText();
targetComboBox->clear();
for(wstring channelName : channelNames)
for (wstring channelName : channelNames)
targetComboBox->addItem(QString::fromStdWString(channelName));
targetComboBox->setEditText(text);
targetComboBox->blockSignals(false);
@@ -148,10 +148,10 @@ vector<Assignment> CopyFilterGUIForm::buildAssignments(QWidget* pressedButton)
vector<Assignment> assignments;
Assignment* currentAssignment = NULL;
for(int row = 0; row < gridLayout->rowCount() - 1; row++)
for (int row = 0; row < gridLayout->rowCount() - 1; row++)
{
QLayoutItem* item = gridLayout->itemAtPosition(row, 1);
if(item != NULL)
if (item != NULL)
{
QComboBox* targetComboBox = qobject_cast<QComboBox*>(item->widget());
QString oc = targetComboBox->currentText().trimmed();
@@ -160,12 +160,12 @@ vector<Assignment> CopyFilterGUIForm::buildAssignments(QWidget* pressedButton)
currentAssignment->targetChannel = oc.toStdWString();
}
if(currentAssignment != NULL)
if (currentAssignment != NULL)
{
if(pressedButton != NULL)
if (pressedButton != NULL)
{
QWidget* removeButton = gridLayout->itemAtPosition(row, 5)->widget();
if(removeButton == pressedButton)
if (removeButton == pressedButton)
{
continue;
}
@@ -175,10 +175,10 @@ vector<Assignment> CopyFilterGUIForm::buildAssignments(QWidget* pressedButton)
CopyFilterGUIRow* summandWidget = qobject_cast<CopyFilterGUIRow*>(summandItem->widget());
currentAssignment->sourceSum.push_back(summandWidget->buildSummand());
if(pressedButton != NULL)
if (pressedButton != NULL)
{
QWidget* addSummandButton = gridLayout->itemAtPosition(row, 4)->widget();
if(addSummandButton == pressedButton)
if (addSummandButton == pressedButton)
{
Assignment::Summand newSummand;
newSummand.channel = L" ";
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -29,7 +29,7 @@ class CopyFilterGUIForm : public QWidget
{
Q_OBJECT
public:
explicit CopyFilterGUIForm(QWidget *parent = 0);
explicit CopyFilterGUIForm(QWidget* parent = 0);
void load(std::vector<Assignment> assignments);
void setChannelNames(const std::vector<std::wstring>& channelNames);
+24 -24
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "CopyFilterGUIRow.h"
@@ -22,8 +22,8 @@
using namespace std;
CopyFilterGUIRow::CopyFilterGUIRow(Assignment::Summand summand, std::vector<wstring> channelNames, QWidget *parent) :
QWidget(parent),
CopyFilterGUIRow::CopyFilterGUIRow(Assignment::Summand summand, std::vector<wstring> channelNames, QWidget* parent)
: QWidget(parent),
ui(new Ui::CopyFilterGUIRow)
{
ui->setupUi(this);
@@ -34,11 +34,11 @@ CopyFilterGUIRow::CopyFilterGUIRow(Assignment::Summand summand, std::vector<wstr
ui->modeComboBox->addItem(tr("Constant value"), 'v');
QChar mode;
if(summand.channel == L"")
if (summand.channel == L"")
mode = 'v';
else if(summand.isDecibel)
else if (summand.isDecibel)
mode = 'd';
else if(summand.factor != 1.0)
else if (summand.factor != 1.0)
mode = 'f';
else
mode = 'c';
@@ -47,7 +47,7 @@ CopyFilterGUIRow::CopyFilterGUIRow(Assignment::Summand summand, std::vector<wstr
ui->factorSpinBox->setValue(summand.factor);
for(wstring channelName : channelNames)
for (wstring channelName : channelNames)
ui->channelComboBox->addItem(QString::fromStdWString(channelName));
ui->channelComboBox->setEditText(QString::fromStdWString(summand.channel).trimmed());
@@ -67,7 +67,7 @@ void CopyFilterGUIRow::setChannelNames(const vector<wstring>& channelNames)
ui->channelComboBox->blockSignals(true);
QString text = ui->channelComboBox->currentText();
ui->channelComboBox->clear();
for(wstring channelName : channelNames)
for (wstring channelName : channelNames)
ui->channelComboBox->addItem(QString::fromStdWString(channelName));
ui->channelComboBox->setEditText(text);
ui->channelComboBox->blockSignals(false);
@@ -78,18 +78,18 @@ Assignment::Summand CopyFilterGUIRow::buildSummand()
Assignment::Summand summand;
QChar mode = ui->modeComboBox->currentData().toChar();
if(mode != 'c')
if (mode != 'c')
summand.factor = ui->factorSpinBox->value();
else
summand.factor = 1.0;
// fix for rounding error when using the spin buttons
if(abs(summand.factor) < 1e-10)
if (abs(summand.factor) < 1e-10)
summand.factor = 0.0;
if(mode != 'v')
if (mode != 'v')
summand.channel = ui->channelComboBox->currentText().trimmed().toStdWString();
// allow channel mode to be remembered when reloading
if(mode == 'c' && summand.channel == L"")
if (mode == 'c' && summand.channel == L"")
summand.channel = L" ";
summand.isDecibel = mode == 'd';
+15 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -32,7 +32,7 @@ class CopyFilterGUIRow : public QWidget
Q_OBJECT
public:
explicit CopyFilterGUIRow(Assignment::Summand summand, std::vector<std::wstring> channelNames, QWidget *parent = 0);
explicit CopyFilterGUIRow(Assignment::Summand summand, std::vector<std::wstring> channelNames, QWidget* parent = 0);
~CopyFilterGUIRow();
void setChannelNames(const std::vector<std::wstring>& channelNames);
@@ -46,5 +46,5 @@ private slots:
void on_modeComboBox_currentIndexChanged(int index);
private:
Ui::CopyFilterGUIRow *ui;
Ui::CopyFilterGUIRow* ui;
};
+30 -30
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
@@ -39,7 +39,7 @@ void CopyFilterGUIScene::load(const vector<wstring>& channelNames, vector<Assign
QGraphicsItem* lastInputItem = NULL;
lastOutputItem = NULL;
for(unsigned i = 0; i < channelNames.size(); i++)
for (unsigned i = 0; i < channelNames.size(); i++)
{
QString c = QString::fromStdWString(channelNames[i]);
@@ -65,13 +65,13 @@ void CopyFilterGUIScene::load(const vector<wstring>& channelNames, vector<Assign
addItem(noChannelItem);
inputChannelMap.insert("", noChannelItem);
for(Assignment assignment : assignments)
for (Assignment assignment : assignments)
{
QString oc = QString::fromStdWString(assignment.targetChannel);
if(oc == "")
if (oc == "")
continue;
CopyFilterGUIChannelItem* outputItem = outputChannelMap.value(oc.toUpper());
if(outputItem == NULL)
if (outputItem == NULL)
{
outputItem = new CopyFilterGUIChannelItem(oc, true);
outputItem->setPos(getNextChannelPoint(lastOutputItem, true));
@@ -80,13 +80,13 @@ void CopyFilterGUIScene::load(const vector<wstring>& channelNames, vector<Assign
outputChannelMap.insert(oc, outputItem);
lastOutputItem = outputItem;
}
for(Assignment::Summand summand : assignment.sourceSum)
for (Assignment::Summand summand : assignment.sourceSum)
{
QString ic = QString::fromStdWString(summand.channel);
if(ic == " ")
if (ic == " ")
continue;
CopyFilterGUIChannelItem* inputItem = inputChannelMap.value(ic.toUpper());
if(inputItem == NULL)
if (inputItem == NULL)
{
inputItem = new CopyFilterGUIChannelItem(ic, false);
inputItem->setPos(getNextChannelPoint(lastInputItem, false));
@@ -114,19 +114,19 @@ std::vector<Assignment> CopyFilterGUIScene::buildAssignments()
{
std::vector<CopyFilterGUIConnectionItem*> connItems;
for(QGraphicsItem* item : items())
for (QGraphicsItem* item : items())
{
CopyFilterGUIConnectionItem* connItem = qgraphicsitem_cast<CopyFilterGUIConnectionItem*>(item);
if(connItem != NULL && connItem->getTarget() != NULL)
if (connItem != NULL && connItem->getTarget() != NULL)
{
connItems.push_back(connItem);
}
}
std::sort(connItems.begin(), connItems.end(), [](CopyFilterGUIConnectionItem * a, CopyFilterGUIConnectionItem * b)
std::sort(connItems.begin(), connItems.end(), [](CopyFilterGUIConnectionItem* a, CopyFilterGUIConnectionItem* b)
{
double diff = a->getTarget()->x() - b->getTarget()->x();
if(diff == 0.0)
if (diff == 0.0)
diff = a->getSource()->x() - b->getSource()->x();
return diff < 0;
@@ -134,11 +134,11 @@ std::vector<Assignment> CopyFilterGUIScene::buildAssignments()
std::vector<Assignment> assignments;
QHash<QString, Assignment*> channelAssignmentMap;
for(CopyFilterGUIConnectionItem* connItem : connItems)
for (CopyFilterGUIConnectionItem* connItem : connItems)
{
QString oc = connItem->getTarget()->getName();
Assignment* assignment = channelAssignmentMap.value(oc);
if(assignment == NULL)
if (assignment == NULL)
{
Assignment newAssignment;
newAssignment.targetChannel = oc.toStdWString();
@@ -177,7 +177,7 @@ void CopyFilterGUIScene::lineEditEditingFinished()
{
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(QObject::sender());
// might be called twice
if(!lineEdit->isVisible())
if (!lineEdit->isVisible())
return;
QString text = lineEdit->text();
@@ -197,12 +197,12 @@ void CopyFilterGUIScene::lineEditEditingFinished()
void CopyFilterGUIScene::keyPressEvent(QKeyEvent* event)
{
// focusItem != NULL means that the cursor is inside a line edit
if(event->key() == Qt::Key_Delete && focusItem() == NULL)
if (event->key() == Qt::Key_Delete && focusItem() == NULL)
{
for(QGraphicsItem* item : selectedItems())
for (QGraphicsItem* item : selectedItems())
{
CopyFilterGUIConnectionItem* connectionItem = qgraphicsitem_cast<CopyFilterGUIConnectionItem*>(item);
if(connectionItem != NULL)
if (connectionItem != NULL)
{
removeItem(connectionItem);
delete connectionItem;
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+16 -16
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "DelayFilterGUI.h"
@@ -24,8 +24,8 @@ static const double dialSteps = 1000;
static const double dialMin = 1.0;
static const double dialMax = 10000.0;
DelayFilterGUI::DelayFilterGUI(double delay, bool isMs) :
ui(new Ui::DelayFilterGUI)
DelayFilterGUI::DelayFilterGUI(double delay, bool isMs)
: ui(new Ui::DelayFilterGUI)
{
ui->setupUi(this);
@@ -42,7 +42,7 @@ void DelayFilterGUI::store(QString& command, QString& parameters)
{
command = "Delay";
parameters = QString("%0").arg(ui->delaySpinBox->value());
if(ui->unitComboBox->currentIndex() == 0)
if (ui->unitComboBox->currentIndex() == 0)
parameters += " ms";
else
parameters += " samples";
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -43,5 +43,5 @@ private slots:
void on_delaySpinBox_valueChanged(double value);
private:
Ui::DelayFilterGUI *ui;
Ui::DelayFilterGUI* ui;
};
+16 -16
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "filters/DelayFilter.h"
@@ -37,17 +37,17 @@ IFilterGUI* DelayFilterGUIFactory::createFilterGUI(QString& command, QString& pa
{
DelayFilterGUI* result = NULL;
if(command == "Delay")
if (command == "Delay")
{
DelayFilterFactory factory;
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
if(!filters.empty())
if (!filters.empty())
{
DelayFilter* filter = (DelayFilter*)filters[0];
result = new DelayFilterGUI(filter->getDelay(), filter->getIsMs());
}
for(IFilter* f : filters)
for (IFilter* f : filters)
{
f->~IFilter();
MemoryHelper::free(f);
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -29,5 +29,5 @@ public:
explicit DelayFilterGUIFactory();
QList<FilterTemplate> createFilterTemplates() override;
IFilterGUI*createFilterGUI(QString& command, QString& parameters) override;;
IFilterGUI* createFilterGUI(QString& command, QString& parameters) override;;
};
+25 -25
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string>
@@ -25,8 +25,8 @@
using namespace std;
DeviceFilterGUI::DeviceFilterGUI(DeviceFilterGUIFactory* factory):
ui(new Ui::DeviceFilterGUI)
DeviceFilterGUI::DeviceFilterGUI(DeviceFilterGUIFactory* factory)
: ui(new Ui::DeviceFilterGUI)
{
ui->setupUi(this);
this->factory = factory;
@@ -52,7 +52,7 @@ void DeviceFilterGUI::load(const QString& parameters)
QTreeWidgetItem* lastItem = NULL;
if(parameters.trimmed() == "all")
if (parameters.trimmed() == "all")
{
QStringList values;
values.append("");
@@ -64,23 +64,23 @@ void DeviceFilterGUI::load(const QString& parameters)
else
{
const QList<DeviceAPOInfo>& devices = factory->getDevices();
for(const DeviceAPOInfo& apoInfo : devices)
for (const DeviceAPOInfo& apoInfo : devices)
{
if(!apoInfo.isInstalled)
if (!apoInfo.isInstalled)
continue;
wstring deviceString = apoInfo.connectionName + L" " + apoInfo.deviceName + L" " + apoInfo.deviceGuid;
if(DeviceFilterFactory::matchDevice(deviceString, pattern.toStdWString()))
if (DeviceFilterFactory::matchDevice(deviceString, pattern.toStdWString()))
{
QStringList values;
if(apoInfo.isInput)
if (apoInfo.isInput)
values.append(tr("Capture"));
else
values.append(tr("Playback"));
values.append(QString::fromStdWString(apoInfo.connectionName));
values.append(QString::fromStdWString(apoInfo.deviceName));
QString state;
if(apoInfo.isInstalled)
if (apoInfo.isInstalled)
state = tr("APO installed");
else
state = tr("APO not installed");
@@ -89,7 +89,7 @@ void DeviceFilterGUI::load(const QString& parameters)
}
}
if(ui->treeWidget->topLevelItemCount() == 0)
if (ui->treeWidget->topLevelItemCount() == 0)
{
QStringList values;
values.append("");
@@ -102,12 +102,12 @@ void DeviceFilterGUI::load(const QString& parameters)
}
}
for(int i = 0; i < ui->treeWidget->columnCount(); i++)
for (int i = 0; i < ui->treeWidget->columnCount(); i++)
ui->treeWidget->resizeColumnToContents(i);
int headerHeight = ui->treeWidget->header()->height();
int itemAreaHeight = 0;
if(lastItem != NULL)
if (lastItem != NULL)
itemAreaHeight = ui->treeWidget->visualItemRect(lastItem).bottom() + 1;
ui->treeWidget->setFixedHeight(headerHeight + itemAreaHeight + 3);
}
@@ -121,7 +121,7 @@ void DeviceFilterGUI::store(QString& command, QString& parameters)
void DeviceFilterGUI::on_pushButton_clicked()
{
DeviceFilterGUIDialog dialog(this, factory, pattern);
if(dialog.exec() == QDialog::Accepted)
if (dialog.exec() == QDialog::Accepted)
{
load(dialog.getPattern());
emit updateModel();
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -40,7 +40,7 @@ private slots:
void on_pushButton_clicked();
private:
Ui::DeviceFilterGUI *ui;
Ui::DeviceFilterGUI* ui;
DeviceFilterGUIFactory* factory;
QString pattern;
};
+28 -28
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "DeviceFilterGUIDialog.h"
@@ -24,8 +24,8 @@
using namespace std;
DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterGUIFactory* factory, const QString& pattern) :
QDialog(gui),
DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterGUIFactory* factory, const QString& pattern)
: QDialog(gui),
ui(new Ui::DeviceFilterGUIDialog)
{
ui->setupUi(this);
@@ -43,13 +43,13 @@ DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterG
QTreeWidgetItem* inputNode = new QTreeWidgetItem(ui->treeWidget, QStringList(tr("Capture devices")));
inputNode->setExpanded(true);
const QList<DeviceAPOInfo>& devices = factory->getDevices();
for(const DeviceAPOInfo& apoInfo : devices)
for (const DeviceAPOInfo& apoInfo : devices)
{
QStringList values;
values.append(QString::fromStdWString(apoInfo.connectionName));
values.append(QString::fromStdWString(apoInfo.deviceName));
QString state;
if(apoInfo.isInstalled)
if (apoInfo.isInstalled)
state = tr("APO installed");
else
state = tr("APO not installed");
@@ -61,12 +61,12 @@ DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterG
item->setCheckState(0, matches ? Qt::Checked : Qt::Unchecked);
item->setData(0, Qt::UserRole, QVariant::fromValue(&apoInfo));
item->setHidden(!matches && !apoInfo.isInstalled && ui->showOnlyInstalledCheckBox->isChecked());
if(!apoInfo.isInstalled)
for(int i = 0; i < ui->treeWidget->columnCount(); i++)
if (!apoInfo.isInstalled)
for (int i = 0; i < ui->treeWidget->columnCount(); i++)
item->setForeground(i, QBrush(Qt::gray));
}
for(int i = 0; i < ui->treeWidget->columnCount(); i++)
for (int i = 0; i < ui->treeWidget->columnCount(); i++)
ui->treeWidget->resizeColumnToContents(i);
}
@@ -77,22 +77,22 @@ DeviceFilterGUIDialog::~DeviceFilterGUIDialog()
QString DeviceFilterGUIDialog::getPattern()
{
if(ui->allDevicesCheckBox->isChecked())
if (ui->allDevicesCheckBox->isChecked())
{
return "all";
}
else
{
QString pattern = "";
for(int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
{
QTreeWidgetItem* groupItem = ui->treeWidget->topLevelItem(i);
for(int j = 0; j < groupItem->childCount(); j++)
for (int j = 0; j < groupItem->childCount(); j++)
{
QTreeWidgetItem* item = groupItem->child(j);
if(item->checkState(0) == Qt::Checked)
if (item->checkState(0) == Qt::Checked)
{
if(pattern != "")
if (pattern != "")
pattern += "; ";
const DeviceAPOInfo* apoInfo = item->data(0, Qt::UserRole).value<const DeviceAPOInfo*>();
wstring deviceString = apoInfo->connectionName + L" " + apoInfo->deviceName + L" " + apoInfo->deviceGuid;
@@ -112,10 +112,10 @@ void DeviceFilterGUIDialog::on_allDevicesCheckBox_toggled(bool checked)
void DeviceFilterGUIDialog::on_showOnlyInstalledCheckBox_toggled(bool checked)
{
for(int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
{
QTreeWidgetItem* groupItem = ui->treeWidget->topLevelItem(i);
for(int j = 0; j < groupItem->childCount(); j++)
for (int j = 0; j < groupItem->childCount(); j++)
{
QTreeWidgetItem* item = groupItem->child(j);
const DeviceAPOInfo* apoInfo = item->data(0, Qt::UserRole).value<const DeviceAPOInfo*>();
@@ -123,6 +123,6 @@ void DeviceFilterGUIDialog::on_showOnlyInstalledCheckBox_toggled(bool checked)
}
}
for(int i = 0; i < ui->treeWidget->columnCount(); i++)
for (int i = 0; i < ui->treeWidget->columnCount(); i++)
ui->treeWidget->resizeColumnToContents(i);
}
+15 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -33,7 +33,7 @@ class DeviceFilterGUIDialog : public QDialog
Q_OBJECT
public:
explicit DeviceFilterGUIDialog( DeviceFilterGUI* gui, DeviceFilterGUIFactory* factory, const QString& pattern);
explicit DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterGUIFactory* factory, const QString& pattern);
~DeviceFilterGUIDialog();
QString getPattern();
@@ -44,7 +44,7 @@ private slots:
void on_showOnlyInstalledCheckBox_toggled(bool checked);
private:
Ui::DeviceFilterGUIDialog *ui;
Ui::DeviceFilterGUIDialog* ui;
};
Q_DECLARE_METATYPE(const DeviceAPOInfo*)
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "Editor/FilterTable.h"
@@ -42,7 +42,7 @@ IFilterGUI* DeviceFilterGUIFactory::createFilterGUI(QString& command, QString& p
{
DeviceFilterGUI* result = NULL;
if(command == "Device")
if (command == "Device")
{
result = new DeviceFilterGUI(this);
result->load(parameters);
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "ExpressionFilterGUIFactory.h"
@@ -22,7 +22,7 @@
IFilterGUI* ExpressionFilterGUIFactory::createFilterGUI(QString& command, QString& parameters)
{
// do not create a gui if parameters contain expressions
if(parameters.contains('`'))
if (parameters.contains('`'))
command = "";
return NULL;
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+59 -59
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <vector>
@@ -36,8 +36,8 @@ using namespace std;
QRegularExpression GraphicEQFilterGUI::numberRegEx("[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?");
GraphicEQFilterGUI::GraphicEQFilterGUI(GraphicEQFilter* filter, QString configPath, FilterTable* filterTable) :
ui(new Ui::GraphicEQFilterGUI), configPath(configPath)
GraphicEQFilterGUI::GraphicEQFilterGUI(GraphicEQFilter* filter, QString configPath, FilterTable* filterTable)
: ui(new Ui::GraphicEQFilterGUI), configPath(configPath)
{
ui->setupUi(this);
@@ -46,10 +46,10 @@ GraphicEQFilterGUI::GraphicEQFilterGUI(GraphicEQFilter* filter, QString configPa
ResizeCorner* cornerWidget = new ResizeCorner(filterTable,
QSize(0, ui->graphicsView->minimumHeight()), QSize(10000 - ui->tableWidget->minimumWidth(), INT_MAX),
[this]() {
[this]() {
return QSize(10000 - ui->tableWidget->width(), ui->graphicsView->height());
},
[this](QSize size) {
[this](QSize size) {
ui->tableWidget->setFixedWidth(10000 - size.width());
ui->graphicsView->setFixedHeight(size.height());
}, ui->graphicsView);
@@ -71,7 +71,7 @@ GraphicEQFilterGUI::GraphicEQFilterGUI(GraphicEQFilter* filter, QString configPa
scene->setNodes(filter->getNodes());
int bandCount = scene->verifyBands(filter->getNodes());
switch(bandCount)
switch (bandCount)
{
case 15:
ui->radioButton15->click();
@@ -91,14 +91,14 @@ GraphicEQFilterGUI::~GraphicEQFilterGUI()
delete ui;
}
void GraphicEQFilterGUI::store(QString & command, QString & parameters)
void GraphicEQFilterGUI::store(QString& command, QString& parameters)
{
command = "GraphicEQ";
bool first = true;
for(FilterNode node : scene->getNodes())
for (FilterNode node : scene->getNodes())
{
if(first)
if (first)
first = false;
else
parameters += "; ";
@@ -113,7 +113,7 @@ void GraphicEQFilterGUI::loadPreferences(const QVariantMap& prefs)
ui->graphicsView->setFixedHeight(prefs.value("viewHeight", DEFAULT_VIEW_HEIGHT).toInt());
double zoomX = prefs.value("zoomX", 1.0).toDouble();
double zoomY = prefs.value("zoomY", 1.0).toDouble();
if(zoomX != 1.0 || zoomY != 1.0)
if (zoomX != 1.0 || zoomY != 1.0)
scene->setZoom(zoomX, zoomY);
int scrollX = prefs.value("scrollX", round(scene->hzToX(20))).toInt();
int scrollY = prefs.value("scrollY", round(scene->dbToY(22))).toInt();
@@ -122,21 +122,21 @@ void GraphicEQFilterGUI::loadPreferences(const QVariantMap& prefs)
void GraphicEQFilterGUI::storePreferences(QVariantMap& prefs)
{
if(ui->tableWidget->width() != DEFAULT_TABLE_WIDTH)
if (ui->tableWidget->width() != DEFAULT_TABLE_WIDTH)
prefs.insert("tableWidth", ui->tableWidget->width());
if(ui->graphicsView->height() != DEFAULT_VIEW_HEIGHT)
if (ui->graphicsView->height() != DEFAULT_VIEW_HEIGHT)
prefs.insert("viewHeight", ui->graphicsView->height());
if(scene->getZoomX() != 1.0)
if (scene->getZoomX() != 1.0)
prefs.insert("zoomX", scene->getZoomX());
if(scene->getZoomY() != 1.0)
if (scene->getZoomY() != 1.0)
prefs.insert("zoomY", scene->getZoomY());
QScrollBar* hScrollBar = ui->graphicsView->horizontalScrollBar();
int value = hScrollBar->value();
if(value != round(scene->hzToX(20)))
if (value != round(scene->hzToX(20)))
prefs.insert("scrollX", value);
QScrollBar* vScrollBar = ui->graphicsView->verticalScrollBar();
value = vScrollBar->value();
if(value != round(scene->dbToY(22)))
if (value != round(scene->dbToY(22)))
prefs.insert("scrollY", value);
}
@@ -180,7 +180,7 @@ void GraphicEQFilterGUI::moveRow(int fromIndex, int toIndex)
ui->tableWidget->insertRow(toIndex);
ui->tableWidget->setItem(toIndex, 0, freqItem);
ui->tableWidget->setItem(toIndex, 1, gainItem);
if(selected)
if (selected)
{
QModelIndex modelIndex = ui->tableWidget->model()->index(toIndex, 0);
ui->tableWidget->selectionModel()->select(modelIndex, QItemSelectionModel::Rows | QItemSelectionModel::Select);
@@ -193,7 +193,7 @@ void GraphicEQFilterGUI::selectRow(int index, bool select)
{
ui->tableWidget->blockSignals(true);
QItemSelectionModel::SelectionFlags command = QItemSelectionModel::Rows;
if(select)
if (select)
command |= QItemSelectionModel::Select;
else
command |= QItemSelectionModel::Deselect;
@@ -205,12 +205,12 @@ void GraphicEQFilterGUI::selectRow(int index, bool select)
void GraphicEQFilterGUI::on_tableWidget_cellChanged(int row, int column)
{
if(column == 0)
if (column == 0)
{
QTableWidgetItem* freqItem = ui->tableWidget->item(row, 0);
bool ok;
double freq = freqItem->text().toDouble(&ok);
if(ok)
if (ok)
{
double gain = scene->getNodes()[row].dbGain;
scene->setNode(row, freq, gain);
@@ -221,12 +221,12 @@ void GraphicEQFilterGUI::on_tableWidget_cellChanged(int row, int column)
freqItem->setText(QString("%0").arg(freq));
}
}
else if(column == 1)
else if (column == 1)
{
QTableWidgetItem* gainItem = ui->tableWidget->item(row, 1);
bool ok;
double gain = gainItem->text().toDouble(&ok);
if(ok)
if (ok)
{
double freq = scene->getNodes()[row].freq;
scene->setNode(row, freq, gain);
@@ -242,7 +242,7 @@ void GraphicEQFilterGUI::on_tableWidget_cellChanged(int row, int column)
void GraphicEQFilterGUI::on_tableWidget_itemSelectionChanged()
{
QSet<int> selectedRows;
for(QTableWidgetItem* item : ui->tableWidget->selectedItems())
for (QTableWidgetItem* item : ui->tableWidget->selectedItems())
selectedRows.insert(item->row());
scene->setSelectedNodes(selectedRows);
@@ -250,7 +250,7 @@ void GraphicEQFilterGUI::on_tableWidget_itemSelectionChanged()
void GraphicEQFilterGUI::on_radioButton15_toggled(bool checked)
{
if(checked)
if (checked)
{
scene->setBandCount(15);
setFreqEditable(false);
@@ -259,7 +259,7 @@ void GraphicEQFilterGUI::on_radioButton15_toggled(bool checked)
void GraphicEQFilterGUI::on_radioButton31_toggled(bool checked)
{
if(checked)
if (checked)
{
scene->setBandCount(31);
setFreqEditable(false);
@@ -268,7 +268,7 @@ void GraphicEQFilterGUI::on_radioButton31_toggled(bool checked)
void GraphicEQFilterGUI::on_radioButtonVar_toggled(bool checked)
{
if(checked)
if (checked)
{
scene->setBandCount(-1);
setFreqEditable(true);
@@ -278,10 +278,10 @@ void GraphicEQFilterGUI::on_radioButtonVar_toggled(bool checked)
void GraphicEQFilterGUI::setFreqEditable(bool editable)
{
ui->tableWidget->blockSignals(true);
for(int i = 0; i < ui->tableWidget->rowCount(); i++)
for (int i = 0; i < ui->tableWidget->rowCount(); i++)
{
QTableWidgetItem* item = ui->tableWidget->item(i, 0);
if(editable)
if (editable)
item->setFlags(item->flags() | Qt::ItemIsEditable | Qt::ItemIsEnabled);
else
item->setFlags(item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsEnabled));
@@ -298,32 +298,32 @@ void GraphicEQFilterGUI::on_actionImport_triggered()
nameFilters.append(tr("Frequency response (*.csv)"));
nameFilters.append(tr("All files (*.*)"));
dialog.setNameFilters(nameFilters);
if(dialog.exec() == QDialog::Accepted)
if (dialog.exec() == QDialog::Accepted)
{
vector<FilterNode> newNodes;
for(QString path : dialog.selectedFiles())
for (QString path : dialog.selectedFiles())
{
QFile file(path);
if(file.open(QFile::ReadOnly))
if (file.open(QFile::ReadOnly))
{
QTextStream stream(&file);
QString text = stream.readAll();
if(!text.contains('.'))
if (!text.contains('.'))
text = text.replace(',', '.');
QRegularExpressionMatchIterator it = numberRegEx.globalMatch(text);
while(it.hasNext())
while (it.hasNext())
{
QRegularExpressionMatch match = it.next();
QString freqString = match.captured();
bool ok;
double freq = freqString.toDouble(&ok);
if(ok && it.hasNext())
if (ok && it.hasNext())
{
match = it.next();
QString gainString = match.captured();
double gain = gainString.toDouble(&ok);
if(ok)
if (ok)
newNodes.push_back(FilterNode(freq, gain));
}
}
@@ -334,9 +334,9 @@ void GraphicEQFilterGUI::on_actionImport_triggered()
scene->setNodes(newNodes);
int bandCount = scene->verifyBands(newNodes);
if(bandCount != scene->getBandCount())
if (bandCount != scene->getBandCount())
{
switch(bandCount)
switch (bandCount)
{
case 15:
ui->radioButton15->click();
@@ -367,15 +367,15 @@ void GraphicEQFilterGUI::on_actionExport_triggered()
dialog.setNameFilters(nameFilters);
dialog.setDefaultSuffix(".csv");
if(dialog.exec() == QDialog::Accepted)
if (dialog.exec() == QDialog::Accepted)
{
QString savePath = dialog.selectedFiles().first();
QFile file(savePath);
if(file.open(QFile::WriteOnly | QFile::Truncate))
if (file.open(QFile::WriteOnly | QFile::Truncate))
{
QTextStream stream(&file);
for(FilterNode node : scene->getNodes())
for (FilterNode node : scene->getNodes())
{
stream << node.freq << '\t' << node.dbGain << '\n';
}
@@ -387,7 +387,7 @@ void GraphicEQFilterGUI::on_actionExport_triggered()
void GraphicEQFilterGUI::on_actionInvertResponse_triggered()
{
vector<FilterNode> newNodes = scene->getNodes();
for(FilterNode& node : newNodes)
for (FilterNode& node : newNodes)
node.dbGain = -node.dbGain;
scene->setNodes(newNodes);
@@ -399,15 +399,15 @@ void GraphicEQFilterGUI::on_actionNormalizeResponse_triggered()
vector<FilterNode> newNodes = scene->getNodes();
double maxGain = -DBL_MAX;
for(FilterNode node : newNodes)
for (FilterNode node : newNodes)
{
if(node.dbGain > maxGain)
if (node.dbGain > maxGain)
maxGain = node.dbGain;
}
if(maxGain != 0)
if (maxGain != 0)
{
for(FilterNode& node : newNodes)
for (FilterNode& node : newNodes)
node.dbGain -= maxGain;
scene->setNodes(newNodes);
@@ -421,9 +421,9 @@ void GraphicEQFilterGUI::on_actionResetResponse_triggered()
QSet<int> selectedIndices = scene->getSelectedIndices();
int index = 0;
for(FilterNode& node : newNodes)
for (FilterNode& node : newNodes)
{
if(selectedIndices.isEmpty() || selectedIndices.contains(index))
if (selectedIndices.isEmpty() || selectedIndices.contains(index))
node.dbGain = 0.0;
index++;
}
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -67,7 +67,7 @@ private slots:
private:
void setFreqEditable(bool editable);
Ui::GraphicEQFilterGUI *ui;
Ui::GraphicEQFilterGUI* ui;
GraphicEQFilterGUIScene* scene;
QString configPath;
static QRegularExpression numberRegEx;
+16 -16
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "filters/GraphicEQFilter.h"
@@ -49,17 +49,17 @@ IFilterGUI* GraphicEQFilterGUIFactory::createFilterGUI(QString& command, QString
{
GraphicEQFilterGUI* result = NULL;
if(command == "GraphicEQ")
if (command == "GraphicEQ")
{
GraphicEQFilterFactory factory;
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
if(!filters.empty())
if (!filters.empty())
{
GraphicEQFilter* filter = (GraphicEQFilter*)filters[0];
result = new GraphicEQFilterGUI(filter, configPath, filterTable);
}
for(IFilter* f : filters)
for (IFilter* f : filters)
{
f->~IFilter();
MemoryHelper::free(f);
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+20 -20
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QPainter>
@@ -46,12 +46,12 @@ QPainterPath GraphicEQFilterGUIItem::shape() const
void GraphicEQFilterGUIItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
painter->setBrush(Qt::white);
if(isSelected())
if (isSelected())
painter->setBrush(QColor(38, 147, 255));
painter->drawPath(shape());
if(index < 99)
if (index < 99)
{
if(isSelected())
if (isSelected())
painter->setPen(Qt::white);
QFont font;
@@ -68,20 +68,20 @@ QVariant GraphicEQFilterGUIItem::itemChange(QGraphicsItem::GraphicsItemChange ch
{
QVariant result = QGraphicsItem::itemChange(change, value);
if(change == ItemScenePositionHasChanged)
if (change == ItemScenePositionHasChanged)
{
GraphicEQFilterGUIScene* s = qobject_cast<GraphicEQFilterGUIScene*>(scene());
s->itemMoved(index);
}
else if(change == ItemSelectedHasChanged)
else if (change == ItemSelectedHasChanged)
{
GraphicEQFilterGUIScene* s = qobject_cast<GraphicEQFilterGUIScene*>(scene());
s->itemSelectionChanged(index, value.toBool());
}
else if(change == ItemPositionChange)
else if (change == ItemPositionChange)
{
GraphicEQFilterGUIScene* s = qobject_cast<GraphicEQFilterGUIScene*>(scene());
if(s->getBandCount() != -1)
if (s->getBandCount() != -1)
{
QPointF newPos = value.toPointF();
newPos.setX(s->hzToX(getHz()));
+15 -15
View File
@@ -1,32 +1,32 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "Editor/widgets/FrequencyPlotItem.h"
class GraphicEQFilterGUIItem: public FrequencyPlotItem
class GraphicEQFilterGUIItem : public FrequencyPlotItem
{
public:
GraphicEQFilterGUIItem(int index, double hz, double db);
enum { Type = UserType + 2 };
enum {Type = UserType + 2};
virtual int type() const
{
return Type;
+67 -67
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
@@ -26,8 +26,8 @@
using namespace std;
GraphicEQFilterGUIScene::GraphicEQFilterGUIScene(QObject* parent) :
FrequencyPlotScene(parent)
GraphicEQFilterGUIScene::GraphicEQFilterGUIScene(QObject* parent)
: FrequencyPlotScene(parent)
{
}
@@ -35,13 +35,13 @@ void GraphicEQFilterGUIScene::setNodes(const std::vector<FilterNode>& nodes)
{
noUpdateModel = true;
for(int i = (int)this->nodes.size() - 1; i >= 0; i--)
for (int i = (int)this->nodes.size() - 1; i >= 0; i--)
removeNode(i);
this->nodes = nodes;
int i = 0;
for(FilterNode node : nodes)
for (FilterNode node : nodes)
{
GraphicEQFilterGUIItem* item = new GraphicEQFilterGUIItem(i, node.freq, node.dbGain);
addItem(item);
@@ -67,20 +67,20 @@ void GraphicEQFilterGUIScene::addNode(double hz, double db)
addItem(item);
item->updatePos();
items.insert(index, item);
for(int i = index + 1; i < items.size(); i++)
for (int i = index + 1; i < items.size(); i++)
items[i]->setIndex(i);
emit nodeInserted(index, hz, db);
QRectF rect = sceneRect();
if(index > 0)
if (index > 0)
rect.setLeft(items[index - 1]->x());
if(index + 1 < items.size())
if (index + 1 < items.size())
rect.setRight(items[index + 1]->x());
update(rect);
for(int i = index + 1; i < items.size(); i++)
for (int i = index + 1; i < items.size(); i++)
items[i]->update();
if(!noUpdateModel)
if (!noUpdateModel)
emit updateModel();
}
@@ -90,20 +90,20 @@ void GraphicEQFilterGUIScene::removeNode(int index)
GraphicEQFilterGUIItem* item = items[index];
removeItem(item);
items.removeAt(index);
for(int i = index; i < items.size(); i++)
for (int i = index; i < items.size(); i++)
items[i]->setIndex(i);
emit nodeRemoved(index);
QRectF rect = sceneRect();
if(index > 0)
if (index > 0)
rect.setLeft(items[index - 1]->x());
if(index < items.size())
if (index < items.size())
rect.setRight(items[index]->x());
update(rect);
for(int i = index; i < items.size(); i++)
for (int i = index; i < items.size(); i++)
items[i]->update();
if(!noUpdateModel)
if (!noUpdateModel)
emit updateModel();
}
@@ -117,24 +117,24 @@ void GraphicEQFilterGUIScene::setNode(int index, double hz, double db)
FilterNode node(hz, db);
vector<FilterNode>::iterator it = lower_bound(nodes.begin(), nodes.end(), node);
int newIndex = it - nodes.begin();
if(newIndex > index)
if (newIndex > index)
newIndex--;
if(newIndex != index)
if (newIndex != index)
{
items.move(index, newIndex);
if(newIndex < index)
if (newIndex < index)
{
for(int i = index; i > newIndex; i--)
for (int i = index; i > newIndex; i--)
nodes[i] = nodes[i - 1];
for(int i = newIndex; i <= index; i++)
for (int i = newIndex; i <= index; i++)
items[i]->setIndex(i);
emit nodeMoved(index, newIndex);
}
else
{
for(int i = index; i < newIndex; i++)
for (int i = index; i < newIndex; i++)
nodes[i] = nodes[i + 1];
for(int i = index; i <= newIndex; i++)
for (int i = index; i <= newIndex; i++)
items[i]->setIndex(i);
emit nodeMoved(index, newIndex);
}
@@ -145,19 +145,19 @@ void GraphicEQFilterGUIScene::setNode(int index, double hz, double db)
QRectF rect = sceneRect();
int lowerIndex = min(index, newIndex);
int upperIndex = max(index, newIndex);
if(lowerIndex > 0)
if (lowerIndex > 0)
rect.setLeft(items[lowerIndex - 1]->x());
if(upperIndex + 1 < items.size())
if (upperIndex + 1 < items.size())
rect.setRight(items[upperIndex + 1]->x());
update(rect);
if(!noUpdateModel)
if (!noUpdateModel)
emit updateModel();
}
void GraphicEQFilterGUIScene::setSelectedNodes(QSet<int> indices)
{
for(GraphicEQFilterGUIItem* item : items)
for (GraphicEQFilterGUIItem* item : items)
item->setSelected(indices.contains(item->getIndex()));
}
@@ -165,8 +165,8 @@ QSet<int> GraphicEQFilterGUIScene::getSelectedIndices()
{
QSet<int> set;
for(GraphicEQFilterGUIItem* item : items)
if(item->isSelected())
for (GraphicEQFilterGUIItem* item : items)
if (item->isSelected())
set.insert(item->getIndex());
return set;
@@ -178,29 +178,29 @@ void GraphicEQFilterGUIScene::itemMoved(int index)
double db = yToDb(item->scenePos().y());
double oldHz = item->getHz();
double hz;
if(getBandCount() != -1)
if (getBandCount() != -1)
{
hz = oldHz;
}
else
{
hz = xToHz(item->scenePos().x());
if(hz >= 10000)
if (hz >= 10000)
hz = round(hz);
else
hz = round(hz * 10) / 10;
item->setHz(hz);
}
if(getZoomY() < 4)
if (getZoomY() < 4)
db = round(db * 10) / 10;
else
db = round(db * 100) / 100;
item->setDb(db);
int newIndex = index;
if(hz < oldHz)
if (hz < oldHz)
{
while(newIndex > 0 && nodes[newIndex - 1].freq > hz)
while (newIndex > 0 && nodes[newIndex - 1].freq > hz)
{
nodes[newIndex] = nodes[newIndex - 1];
items[newIndex] = items[newIndex - 1];
@@ -208,9 +208,9 @@ void GraphicEQFilterGUIScene::itemMoved(int index)
newIndex--;
}
}
else if(hz > oldHz)
else if (hz > oldHz)
{
while(newIndex < (int)nodes.size() - 1 && nodes[newIndex + 1].freq < hz)
while (newIndex < (int)nodes.size() - 1 && nodes[newIndex + 1].freq < hz)
{
nodes[newIndex] = nodes[newIndex + 1];
items[newIndex] = items[newIndex + 1];
@@ -219,7 +219,7 @@ void GraphicEQFilterGUIScene::itemMoved(int index)
}
}
nodes[newIndex] = FilterNode(hz, db);
if(newIndex != index)
if (newIndex != index)
{
items[newIndex] = item;
item->setIndex(newIndex);
@@ -230,13 +230,13 @@ void GraphicEQFilterGUIScene::itemMoved(int index)
QRectF rect = sceneRect();
int lowerIndex = min(index, newIndex);
int upperIndex = max(index, newIndex);
if(lowerIndex > 0)
if (lowerIndex > 0)
rect.setLeft(items[lowerIndex - 1]->x());
if(upperIndex + 1 < items.size())
if (upperIndex + 1 < items.size())
rect.setRight(items[upperIndex + 1]->x());
update(rect);
if(!noUpdateModel)
if (!noUpdateModel)
emit updateModel();
}
@@ -247,7 +247,7 @@ void GraphicEQFilterGUIScene::itemSelectionChanged(int index, bool selected)
void GraphicEQFilterGUIScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
{
if(getBandCount() != -1)
if (getBandCount() != -1)
return;
double hz = xToHz(event->scenePos().x());
@@ -257,15 +257,15 @@ void GraphicEQFilterGUIScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev
void GraphicEQFilterGUIScene::keyPressEvent(QKeyEvent* event)
{
switch(event->key())
switch (event->key())
{
case Qt::Key_Delete:
if(getBandCount() == -1)
if (getBandCount() == -1)
{
for(QGraphicsItem* item : selectedItems())
for (QGraphicsItem* item : selectedItems())
{
GraphicEQFilterGUIItem* plotItem = qgraphicsitem_cast<GraphicEQFilterGUIItem*>(item);
if(plotItem != NULL)
if (plotItem != NULL)
{
// this works for multiple items because the index of the other items is updated inside removeNode
int index = plotItem->getIndex();
@@ -279,14 +279,14 @@ void GraphicEQFilterGUIScene::keyPressEvent(QKeyEvent* event)
case Qt::Key_Down:
case Qt::Key_Left:
case Qt::Key_Right:
for(QGraphicsItem* item : selectedItems())
for (QGraphicsItem* item : selectedItems())
{
GraphicEQFilterGUIItem* plotItem = qgraphicsitem_cast<GraphicEQFilterGUIItem*>(item);
if(plotItem != NULL)
if (plotItem != NULL)
{
int index = plotItem->getIndex();
FilterNode node = nodes[index];
switch(event->key())
switch (event->key())
{
case Qt::Key_Up:
node.dbGain += 1;
@@ -307,7 +307,7 @@ void GraphicEQFilterGUIScene::keyPressEvent(QKeyEvent* event)
break;
case Qt::Key_A:
if(event->modifiers() & Qt::ControlModifier)
if (event->modifiers() & Qt::ControlModifier)
{
QPainterPath painterPath;
painterPath.addRect(sceneRect());
@@ -327,12 +327,12 @@ int GraphicEQFilterGUIScene::verifyBands(const std::vector<FilterNode>& nodes)
const vector<double>& bands = getBands((int)nodes.size());
int bandCount = -1;
if(!bands.empty())
if (!bands.empty())
{
bandCount = (int)nodes.size();
for(unsigned i = 0; i < nodes.size(); i++)
for (unsigned i = 0; i < nodes.size(); i++)
{
if(abs(nodes[i].freq - bands[i]) > 0.1)
if (abs(nodes[i].freq - bands[i]) > 0.1)
{
bandCount = -1;
break;
@@ -345,14 +345,14 @@ int GraphicEQFilterGUIScene::verifyBands(const std::vector<FilterNode>& nodes)
void GraphicEQFilterGUIScene::setBandCount(int value)
{
if(value != getBandCount())
if (value != getBandCount())
{
const vector<double>& bands = getBands(value);
if(!bands.empty())
if (!bands.empty())
{
vector<FilterNode> newNodes;
GainIterator gainIterator(nodes);
for(double band : bands)
for (double band : bands)
{
double dbGain = gainIterator.gainAt(band);
dbGain = round(dbGain * 100) / 100;
@@ -365,7 +365,7 @@ void GraphicEQFilterGUIScene::setBandCount(int value)
FrequencyPlotScene::setBandCount(value);
if(!noUpdateModel)
if (!noUpdateModel)
emit updateModel();
}
}
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -29,7 +29,7 @@ class GraphicEQFilterGUIScene : public FrequencyPlotScene
{
Q_OBJECT
public:
explicit GraphicEQFilterGUIScene(QObject *parent = 0);
explicit GraphicEQFilterGUIScene(QObject* parent = 0);
void setNodes(const std::vector<FilterNode>& nodes);
void addNode(double hz, double db);
void removeNode(int index);
+18 -18
View File
@@ -1,27 +1,27 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "GraphicEQFilterGUIScene.h"
#include "GraphicEQFilterGUIView.h"
GraphicEQFilterGUIView::GraphicEQFilterGUIView(QWidget *parent) :
FrequencyPlotView(parent)
GraphicEQFilterGUIView::GraphicEQFilterGUIView(QWidget* parent)
: FrequencyPlotView(parent)
{
}
@@ -36,15 +36,15 @@ void GraphicEQFilterGUIView::drawBackground(QPainter* painter, const QRectF& rec
QPainterPath path;
bool first = true;
double lastDb = -1000;
for(int x = rect.left() - 1; x <= rect.right() + 1; x++)
for (int x = rect.left() - 1; x <= rect.right() + 1; x++)
{
double hz = s->xToHz(x);
double db = gainIterator.gainAt(hz);
double y = s->dbToY(db);
if(db == lastDb)
if (db == lastDb)
y = floor(y) + 0.5;
lastDb = db;
if(first)
if (first)
{
path.moveTo(x, y);
first = false;
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -26,7 +26,7 @@ class GraphicEQFilterGUIView : public FrequencyPlotView
Q_OBJECT
public:
explicit GraphicEQFilterGUIView(QWidget *parent = 0);
explicit GraphicEQFilterGUIView(QWidget* parent = 0);
protected:
void drawBackground(QPainter* painter, const QRectF& rect) override;
+20 -20
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QFileDialog>
@@ -22,8 +22,8 @@
#include "IncludeFilterGUI.h"
#include "ui_IncludeFilterGUI.h"
IncludeFilterGUI::IncludeFilterGUI(FilterTable* filterTable, const QString& path) :
ui(new Ui::IncludeFilterGUI), filterTable(filterTable)
IncludeFilterGUI::IncludeFilterGUI(FilterTable* filterTable, const QString& path)
: ui(new Ui::IncludeFilterGUI), filterTable(filterTable)
{
ui->setupUi(this);
@@ -46,19 +46,19 @@ void IncludeFilterGUI::on_selectFileToolButton_clicked()
QFileInfo fileInfo(filterTable->getConfigPath());
QDir configDir = fileInfo.absoluteDir();
QString path = ui->pathLineEdit->text();
if(path.length() > 0)
if (path.length() > 0)
fileInfo.setFile(configDir, path);
QFileDialog dialog(this, tr("Include file"), fileInfo.absolutePath(), "*.txt");
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("E-APO configurations (*.txt)"));
if(path.length() > 0)
if (path.length() > 0)
dialog.selectFile(fileInfo.fileName());
if(dialog.exec() == QDialog::Accepted)
if (dialog.exec() == QDialog::Accepted)
{
QString absolutePath = dialog.selectedFiles().first();
QString relativePath = configDir.relativeFilePath(absolutePath);
if(relativePath.startsWith("../../"))
if (relativePath.startsWith("../../"))
relativePath = absolutePath;
ui->pathLineEdit->setText(QDir::toNativeSeparators(relativePath));
@@ -76,7 +76,7 @@ void IncludeFilterGUI::on_openFileToolButton_clicked()
QFileInfo fileInfo(filterTable->getConfigPath());
QDir configDir = fileInfo.absoluteDir();
QString path = ui->pathLineEdit->text();
if(path.length() > 0)
if (path.length() > 0)
{
fileInfo.setFile(configDir, path);
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -42,6 +42,6 @@ private slots:
void on_openFileToolButton_clicked();
private:
Ui::IncludeFilterGUI *ui;
Ui::IncludeFilterGUI* ui;
FilterTable* filterTable;
};
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "IncludeFilterGUI.h"
@@ -40,7 +40,7 @@ IFilterGUI* IncludeFilterGUIFactory::createFilterGUI(QString& command, QString&
{
IncludeFilterGUI* result = NULL;
if(command == "Include")
if (command == "Include")
{
result = new IncludeFilterGUI(filterTable, parameters.trimmed());
}
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+15 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <cmath>
@@ -24,8 +24,8 @@
using namespace std;
PreampFilterGUI::PreampFilterGUI(double dbGain):
ui(new Ui::PreampFilterGUI)
PreampFilterGUI::PreampFilterGUI(double dbGain)
: ui(new Ui::PreampFilterGUI)
{
ui->setupUi(this);
+14 -15
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -22,8 +22,7 @@
#include "Editor/IFilterGUI.h"
#include <filters/PreampFilter.h>
namespace Ui
{
namespace Ui {
class PreampFilterGUI;
}
+16 -16
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "PreampFilterGUI.h"
@@ -32,17 +32,17 @@ IFilterGUI* PreampFilterGUIFactory::createFilterGUI(QString& command, QString& p
{
PreampFilterGUI* result = NULL;
if(command == "Preamp")
if (command == "Preamp")
{
PreampFilterFactory factory;
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
if(!filters.empty())
if (!filters.empty())
{
PreampFilter* filter = (PreampFilter*)filters[0];
result = new PreampFilterGUI(filter->getDbGain());
}
for(IFilter* f : filters)
for (IFilter* f : filters)
{
f->~IFilter();
MemoryHelper::free(f);
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2014 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+18 -18
View File
@@ -1,27 +1,27 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "StageFilterGUI.h"
#include "ui_StageFilterGUI.h"
StageFilterGUI::StageFilterGUI(const QString& parameters) :
ui(new Ui::StageFilterGUI)
StageFilterGUI::StageFilterGUI(const QString& parameters)
: ui(new Ui::StageFilterGUI)
{
ui->setupUi(this);
@@ -40,11 +40,11 @@ void StageFilterGUI::store(QString& command, QString& parameters)
{
command = "Stage";
QStringList list;
if(ui->preMixCheckBox->isChecked())
if (ui->preMixCheckBox->isChecked())
list.append("pre-mix");
if(ui->postMixCheckBox->isChecked())
if (ui->postMixCheckBox->isChecked())
list.append("post-mix");
if(ui->captureCheckBox->isChecked())
if (ui->captureCheckBox->isChecked())
list.append("capture");
parameters = list.join(' ');
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
@@ -43,5 +43,5 @@ private slots:
void on_captureCheckBox_toggled(bool checked);
private:
Ui::StageFilterGUI *ui;
Ui::StageFilterGUI* ui;
};
+14 -14
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "StageFilterGUI.h"
@@ -31,7 +31,7 @@ IFilterGUI* StageFilterGUIFactory::createFilterGUI(QString& command, QString& pa
{
StageFilterGUI* result = NULL;
if(command == "Stage")
if (command == "Stage")
{
result = new StageFilterGUI(parameters);
}
+13 -13
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
+17 -17
View File
@@ -1,37 +1,37 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <QWidget>
#include "DisableWheelFilter.h"
DisableWheelFilter::DisableWheelFilter(QObject* scrollTarget, QObject *parent) :
QObject(parent), scrollTarget(scrollTarget)
DisableWheelFilter::DisableWheelFilter(QObject* scrollTarget, QObject* parent)
: QObject(parent), scrollTarget(scrollTarget)
{
}
bool DisableWheelFilter::eventFilter(QObject* obj, QEvent* event)
{
if(event->type() == QEvent::Wheel)
if (event->type() == QEvent::Wheel)
{
QWidget* widget = qobject_cast<QWidget*>(obj);
if(widget == NULL || !widget->hasFocus())
if (widget == NULL || !widget->hasFocus())
{
QApplication::sendEvent(scrollTarget, event);
return true;
Loaded 100 of 202 files, more files were not shown because too many files have changed in this diff. Show more