Improved: Updated to Visual Studio 2019 and Qt 5.15.2. Running Equalizer APO requires Universal CRT now, which means that Windows versions before 10 may need additional Windows updates or the Visual C++ Redistributable for Visual Studio 2015 - 2019 needs to be installed (installer provides assistance).
This commit is contained in:
1 parent
3d51af7364
commit
c692f0639b
94 files changed
+362
-184
No files matched your search
@@ -44,7 +44,7 @@ void AnalysisPlotScene::setFreqData(fftwf_complex* freqData, int frameCount, uns
|
||||
update();
|
||||
}
|
||||
|
||||
vector<FilterNode> AnalysisPlotScene::getNodes() const
|
||||
const vector<FilterNode>& AnalysisPlotScene::getNodes() const
|
||||
{
|
||||
return nodes;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
void setFreqData(fftwf_complex* freqData, int frameCount, unsigned sampleRate);
|
||||
|
||||
std::vector<FilterNode> getNodes() const;
|
||||
const std::vector<FilterNode>& getNodes() const;
|
||||
|
||||
private:
|
||||
std::vector<FilterNode> nodes;
|
||||
|
||||
@@ -36,7 +36,7 @@ void AnalysisPlotView::drawBackground(QPainter* painter, const QRectF& rect)
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
AnalysisPlotScene* s = qobject_cast<AnalysisPlotScene*>(scene());
|
||||
std::vector<FilterNode>& nodes = s->getNodes();
|
||||
const std::vector<FilterNode>& nodes = s->getNodes();
|
||||
GainIterator gainIterator(nodes);
|
||||
QPainterPath path;
|
||||
bool first = true;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <fftw3.h>
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ FilterTable::~FilterTable()
|
||||
factories.clear();
|
||||
}
|
||||
|
||||
void FilterTable::initialize(QScrollArea* scrollArea, const QList<shared_ptr<AbstractAPOInfo> >& outputDevices, const QList<shared_ptr<AbstractAPOInfo> >& inputDevices)
|
||||
void FilterTable::initialize(QScrollArea* scrollArea, const QList<shared_ptr<AbstractAPOInfo>>& outputDevices, const QList<shared_ptr<AbstractAPOInfo>>& inputDevices)
|
||||
{
|
||||
this->scrollArea = scrollArea;
|
||||
this->outputDevices = outputDevices;
|
||||
@@ -144,7 +144,7 @@ void FilterTable::updateGuis()
|
||||
timer.start();
|
||||
|
||||
gridLayout = new QGridLayout(this);
|
||||
gridLayout->setMargin(0);
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
gridLayout->setSpacing(0);
|
||||
gridLayout->setColumnStretch(0, 0);
|
||||
gridLayout->setColumnStretch(1, 1);
|
||||
@@ -926,7 +926,7 @@ void FilterTable::keyPressEvent(QKeyEvent* event)
|
||||
void FilterTable::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
scrollingNow = true;
|
||||
scrollStartPoint = event->globalPos();
|
||||
scrollStartPoint = event->globalPosition();
|
||||
|
||||
QWidget::wheelEvent(event);
|
||||
}
|
||||
@@ -939,7 +939,7 @@ bool FilterTable::eventFilter(QObject* obj, QEvent* event)
|
||||
if (type == QEvent::Wheel)
|
||||
{
|
||||
QWheelEvent* wheelEvent = (QWheelEvent*)event;
|
||||
scrollStartPoint = wheelEvent->globalPos();
|
||||
scrollStartPoint = wheelEvent->globalPosition();
|
||||
|
||||
QWidget* widget = qobject_cast<QWidget*>(obj);
|
||||
if (widget != NULL)
|
||||
@@ -1059,12 +1059,12 @@ const QSet<FilterTable::Item*>& FilterTable::getSelectedItems() const
|
||||
return selected;
|
||||
}
|
||||
|
||||
const QList<shared_ptr<AbstractAPOInfo> >& FilterTable::getOutputDevices() const
|
||||
const QList<shared_ptr<AbstractAPOInfo>>& FilterTable::getOutputDevices() const
|
||||
{
|
||||
return outputDevices;
|
||||
}
|
||||
|
||||
const QList<shared_ptr<AbstractAPOInfo> >& FilterTable::getInputDevices() const
|
||||
const QList<shared_ptr<AbstractAPOInfo>>& FilterTable::getInputDevices() const
|
||||
{
|
||||
return inputDevices;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
explicit FilterTable(MainWindow* mainWindow, QWidget* parent = 0);
|
||||
~FilterTable();
|
||||
void initialize(QScrollArea* scrollArea, const QList<std::shared_ptr<AbstractAPOInfo> >& outputDevices, const QList<std::shared_ptr<AbstractAPOInfo> >& inputDevices);
|
||||
void initialize(QScrollArea* scrollArea, const QList<std::shared_ptr<AbstractAPOInfo>>& outputDevices, const QList<std::shared_ptr<AbstractAPOInfo>>& inputDevices);
|
||||
void updateDeviceAndChannelMask(std::shared_ptr<AbstractAPOInfo> selectedDevice, int selectedChannelMask);
|
||||
void updateGuis();
|
||||
void propagateChannels();
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
void deleteSelectedLines();
|
||||
void selectAll();
|
||||
|
||||
const QList<std::shared_ptr<AbstractAPOInfo> >& getOutputDevices() const;
|
||||
const QList<std::shared_ptr<AbstractAPOInfo> >& getInputDevices() const;
|
||||
const QList<std::shared_ptr<AbstractAPOInfo>>& getOutputDevices() const;
|
||||
const QList<std::shared_ptr<AbstractAPOInfo>>& getInputDevices() const;
|
||||
std::shared_ptr<AbstractAPOInfo> getSelectedDevice() const;
|
||||
int getSelectedChannelMask() const;
|
||||
|
||||
@@ -135,9 +135,9 @@ private:
|
||||
Item* selectionStart = NULL;
|
||||
QList<IFilterGUIFactory*> factories;
|
||||
bool scrollingNow = false;
|
||||
QPoint scrollStartPoint;
|
||||
QList<std::shared_ptr<AbstractAPOInfo> > outputDevices;
|
||||
QList<std::shared_ptr<AbstractAPOInfo> > inputDevices;
|
||||
QPointF scrollStartPoint;
|
||||
QList<std::shared_ptr<AbstractAPOInfo>> outputDevices;
|
||||
QList<std::shared_ptr<AbstractAPOInfo>> inputDevices;
|
||||
std::shared_ptr<AbstractAPOInfo> selectedDevice;
|
||||
int selectedChannelMask;
|
||||
QString configPath;
|
||||
|
||||
@@ -170,7 +170,7 @@ void FilterTableRow::on_actionEditText_triggered(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (!lastEditTime.isValid() || lastEditTime.elapsed() > 100)
|
||||
if (!lastEditTime.isValid() || lastEditTime.msecsTo(QDateTime::currentDateTimeUtc()) > 100)
|
||||
{
|
||||
ui->lineEdit->setText(item->text);
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
@@ -199,7 +199,7 @@ void FilterTableRow::on_lineEdit_editingFinished()
|
||||
else
|
||||
{
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
lastEditTime.start();
|
||||
lastEditTime = QDateTime::currentDateTimeUtc();
|
||||
ui->actionEditText->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,5 +60,5 @@ private:
|
||||
FilterTable::Item* item;
|
||||
IFilterGUI* gui;
|
||||
bool editingDone = false;
|
||||
QTime lastEditTime;
|
||||
QDateTime lastEditTime;
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
This file is part of Equalizer APO, a system-wide equalizer.
|
||||
Copyright (C) %YEAR% 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 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.
|
||||
*/
|
||||
|
||||
+29
-19
@@ -51,8 +51,8 @@ using namespace std;
|
||||
MainWindow::MainWindow(QDir configDir, QWidget* parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow), configDir(configDir)
|
||||
{
|
||||
outputDevices = QList<shared_ptr<AbstractAPOInfo> >::fromVector(QVector<shared_ptr<AbstractAPOInfo> >::fromStdVector(DeviceAPOInfo::loadAllInfos(false)));
|
||||
inputDevices = QList<shared_ptr<AbstractAPOInfo> >::fromVector(QVector<shared_ptr<AbstractAPOInfo> >::fromStdVector(DeviceAPOInfo::loadAllInfos(true)));
|
||||
outputDevices = toQList(DeviceAPOInfo::loadAllInfos(false));
|
||||
inputDevices = toQList(DeviceAPOInfo::loadAllInfos(true));
|
||||
|
||||
defaultOutputDevice = NULL;
|
||||
for (shared_ptr<AbstractAPOInfo>& apoInfo : outputDevices)
|
||||
@@ -141,7 +141,7 @@ MainWindow::MainWindow(QDir configDir, QWidget* parent)
|
||||
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 (size_t i = 0; i < sizeof(languages) / sizeof(QLocale::Language); i++)
|
||||
{
|
||||
QLocale::Language language = languages[i];
|
||||
QString languageName;
|
||||
@@ -228,7 +228,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);
|
||||
unsigned long long result = (unsigned long long)ShellExecuteW(NULL, L"open", file.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
if (result == SE_ERR_ACCESSDENIED)
|
||||
ShellExecuteW(NULL, L"runas", file.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ void MainWindow::load(QString path)
|
||||
encodedLine.resize(encodedLine.size() - 1);
|
||||
|
||||
wstring line = StringHelper::toWString(encodedLine, CP_UTF8);
|
||||
if (line.find(L'\uFFFD') != -1)
|
||||
if (line.find(L'\uFFFD') != wstring::npos)
|
||||
line = StringHelper::toWString(encodedLine, CP_ACP);
|
||||
|
||||
lines.append(QString::fromStdWString(line));
|
||||
@@ -402,7 +402,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
|
||||
void MainWindow::deviceSelected(int index)
|
||||
{
|
||||
shared_ptr<AbstractAPOInfo> apoInfo = deviceComboBox->itemData(index).value<shared_ptr<AbstractAPOInfo> >();
|
||||
shared_ptr<AbstractAPOInfo> apoInfo = deviceComboBox->itemData(index).value<shared_ptr<AbstractAPOInfo>>();
|
||||
if (apoInfo == NULL)
|
||||
apoInfo = defaultOutputDevice;
|
||||
|
||||
@@ -415,7 +415,7 @@ void MainWindow::deviceSelected(int index)
|
||||
const GUIChannelHelper::ChannelConfigurationInfo* selectedInfo = NULL;
|
||||
for (const GUIChannelHelper::ChannelConfigurationInfo& info : infos)
|
||||
{
|
||||
if (info.channelMask == apoInfo->getChannelMask())
|
||||
if (info.channelMask == (int)apoInfo->getChannelMask())
|
||||
{
|
||||
selectedInfo = &info;
|
||||
break;
|
||||
@@ -425,7 +425,7 @@ void MainWindow::deviceSelected(int index)
|
||||
if (selectedInfo != NULL)
|
||||
channelConfigurationComboBox->addItem(tr("From device") + " (" + selectedInfo->name + ")", 0);
|
||||
else if (apoInfo->getChannelCount() != 0)
|
||||
channelConfigurationComboBox->addItem(tr("From device") + " (" + apoInfo->getChannelCount() + " channels)", 0);
|
||||
channelConfigurationComboBox->addItem((tr("From device") + " (%1 channels)").arg(apoInfo->getChannelCount()), 0);
|
||||
else
|
||||
channelConfigurationComboBox->addItem(tr("From device") + " (? channels)", 0);
|
||||
}
|
||||
@@ -458,7 +458,7 @@ void MainWindow::channelConfigurationSelected(int index)
|
||||
if (selectedDevice != NULL)
|
||||
{
|
||||
unsigned channelCount = selectedDevice->getChannelCount();
|
||||
if (channelMask != 0 && channelMask != selectedDevice->getChannelMask())
|
||||
if (channelMask != 0 && channelMask != (int)selectedDevice->getChannelMask())
|
||||
{
|
||||
channelCount = 0;
|
||||
for (int i = 0; i < 31; i++)
|
||||
@@ -475,7 +475,7 @@ void MainWindow::channelConfigurationSelected(int index)
|
||||
}
|
||||
|
||||
vector<wstring> channelNames = ChannelHelper::getChannelNames(channelCount, channelMask);
|
||||
for (wstring channelName : channelNames)
|
||||
for (const wstring& channelName : channelNames)
|
||||
{
|
||||
ui->analysisChannelComboBox->addItem(QString::fromStdWString(channelName));
|
||||
}
|
||||
@@ -615,7 +615,7 @@ void MainWindow::on_actionSaveAs_triggered()
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString savePath = dialog.selectedFiles().first();
|
||||
QString savePath = dialog.selectedFiles().at(0);
|
||||
save(filterTable, savePath);
|
||||
filterTable->setConfigPath(QDir::toNativeSeparators(savePath));
|
||||
|
||||
@@ -817,12 +817,12 @@ 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)
|
||||
{
|
||||
QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat);
|
||||
for (QString key : settings.childGroups())
|
||||
for (const QString& key : settings.childGroups())
|
||||
{
|
||||
if (key != "file-specific")
|
||||
settings.remove(key);
|
||||
}
|
||||
for (QString key : settings.childKeys())
|
||||
for (const QString& key : settings.childKeys())
|
||||
settings.remove(key);
|
||||
|
||||
restart = true;
|
||||
@@ -836,9 +836,9 @@ 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)
|
||||
{
|
||||
QSettings settings(QString::fromWCharArray(EDITOR_PER_FILE_REGPATH), QSettings::NativeFormat);
|
||||
for (QString key : settings.childGroups())
|
||||
for (const QString& key : settings.childGroups())
|
||||
settings.remove(key);
|
||||
for (QString key : settings.childKeys())
|
||||
for (const QString& key : settings.childKeys())
|
||||
settings.remove(key);
|
||||
|
||||
restart = true;
|
||||
@@ -871,7 +871,7 @@ FilterTable* MainWindow::addTab(QString title, QString tooltip, QString configPa
|
||||
|
||||
void MainWindow::getDeviceAndChannelMask(shared_ptr<AbstractAPOInfo>* selectedDevice, int* channelMask)
|
||||
{
|
||||
*selectedDevice = deviceComboBox->currentData().value<shared_ptr<AbstractAPOInfo> >();
|
||||
*selectedDevice = deviceComboBox->currentData().value<shared_ptr<AbstractAPOInfo>>();
|
||||
if (*selectedDevice == NULL)
|
||||
*selectedDevice = defaultOutputDevice;
|
||||
|
||||
@@ -981,7 +981,7 @@ void MainWindow::loadPreferences()
|
||||
{
|
||||
for (int i = 0; i < deviceComboBox->count(); i++)
|
||||
{
|
||||
shared_ptr<AbstractAPOInfo> apoInfo = deviceComboBox->itemData(i).value<shared_ptr<AbstractAPOInfo> >();
|
||||
shared_ptr<AbstractAPOInfo> apoInfo = deviceComboBox->itemData(i).value<shared_ptr<AbstractAPOInfo>>();
|
||||
if (apoInfo != NULL)
|
||||
{
|
||||
if (QString::fromStdWString(apoInfo->getDeviceString()).compare(selectedDevice, Qt::CaseInsensitive) == 0)
|
||||
@@ -1055,7 +1055,7 @@ void MainWindow::savePreferences()
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
settings.setValue("windowState", saveState());
|
||||
settings.setValue("instantMode", instantModeCheckBox->isChecked());
|
||||
shared_ptr<AbstractAPOInfo> selectedDevice = deviceComboBox->currentData().value<shared_ptr<AbstractAPOInfo> >();
|
||||
shared_ptr<AbstractAPOInfo> selectedDevice = deviceComboBox->currentData().value<shared_ptr<AbstractAPOInfo>>();
|
||||
settings.setValue("selectedDevice", selectedDevice != NULL ? QString::fromStdWString(selectedDevice->getDeviceString()) : "");
|
||||
int channelMask = channelConfigurationComboBox->currentData().toInt();
|
||||
settings.setValue("selectedChannelMask", channelMask);
|
||||
@@ -1105,7 +1105,7 @@ void MainWindow::updateRecentFiles()
|
||||
if (separatorsFound == 1)
|
||||
{
|
||||
QList<QAction*> newActions;
|
||||
for (QString recentFile : recentFiles)
|
||||
for (const QString& recentFile : recentFiles)
|
||||
{
|
||||
QAction* newAction = new QAction(recentFile, ui->menuFile);
|
||||
connect(newAction, SIGNAL(triggered(bool)), this, SLOT(recentFileSelected()));
|
||||
@@ -1124,3 +1124,13 @@ void MainWindow::updateRecentFiles()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> QList<T> MainWindow::toQList(const std::vector<T>& vector)
|
||||
{
|
||||
QList<T> list;
|
||||
list.reserve((int)vector.size());
|
||||
for (T t : vector)
|
||||
list.append(t);
|
||||
|
||||
return list;
|
||||
}
|
||||
+3
-2
@@ -98,6 +98,7 @@ private:
|
||||
void loadPreferences();
|
||||
void savePreferences();
|
||||
void updateRecentFiles();
|
||||
template<class T> QList<T> toQList(const std::vector<T>& vector);
|
||||
|
||||
Ui::MainWindow* ui;
|
||||
|
||||
@@ -105,8 +106,8 @@ private:
|
||||
QCheckBox* instantModeCheckBox;
|
||||
QComboBox* deviceComboBox;
|
||||
QComboBox* channelConfigurationComboBox;
|
||||
QList<std::shared_ptr<AbstractAPOInfo> > outputDevices;
|
||||
QList<std::shared_ptr<AbstractAPOInfo> > inputDevices;
|
||||
QList<std::shared_ptr<AbstractAPOInfo>> outputDevices;
|
||||
QList<std::shared_ptr<AbstractAPOInfo>> inputDevices;
|
||||
std::shared_ptr<AbstractAPOInfo> defaultOutputDevice;
|
||||
AnalysisPlotScene* analysisPlotScene;
|
||||
AnalysisThread* analysisThread = NULL;
|
||||
|
||||
@@ -48,7 +48,9 @@ IFilterGUI* BiQuadFilterGUIFactory::createFilterGUI(QString& command, QString& p
|
||||
if (command.startsWith("Filter"))
|
||||
{
|
||||
BiQuadFilterFactory factory;
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
|
||||
std::wstring commandWStr = command.toStdWString();
|
||||
std::wstring paramWStr = parameters.toStdWString();
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", commandWStr, paramWStr);
|
||||
if (!filters.empty())
|
||||
{
|
||||
BiQuadFilter* filter = (BiQuadFilter*)filters[0];
|
||||
|
||||
@@ -37,7 +37,7 @@ ChannelFilterGUI::ChannelFilterGUI(const QString& parameters, int selectedChanne
|
||||
|
||||
selectedChannels.clear();
|
||||
|
||||
QStringList words = parameters.trimmed().split(' ', QString::SkipEmptyParts);
|
||||
QStringList words = parameters.trimmed().split(' ', Qt::SkipEmptyParts);
|
||||
for (QString word : words)
|
||||
if (word.length() > 0)
|
||||
selectedChannels.append(word.toUpper());
|
||||
|
||||
@@ -92,7 +92,7 @@ ChannelFilterGUIDialog::ChannelFilterGUIDialog(QWidget* parent, QStringList sele
|
||||
else if (channelName == "LFE" && remainingSelectedChannels.removeOne("SUB"))
|
||||
checked = true;
|
||||
|
||||
if (remainingSelectedChannels.removeOne(QString(channelIndex)))
|
||||
if (remainingSelectedChannels.removeOne(QString("%1").arg(channelIndex)))
|
||||
checked = true;
|
||||
checkBox->setChecked(checked);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ QPainterPath CopyFilterGUIConnectionItem::shape() const
|
||||
double length = line().length();
|
||||
if (length > 0)
|
||||
{
|
||||
double offset = min(length, DPIHelper::scale(maxArrowSize));
|
||||
double offset = fmin(length, DPIHelper::scale(maxArrowSize));
|
||||
QLineF unit = l.unitVector();
|
||||
QLineF normal = l.normalVector().unitVector();
|
||||
QPointF v(unit.dx(), unit.dy());
|
||||
@@ -131,7 +131,7 @@ void CopyFilterGUIConnectionItem::paint(QPainter* painter, const QStyleOptionGra
|
||||
painter->drawLine(line());
|
||||
|
||||
double length = line().length();
|
||||
double offset = min(length, DPIHelper::scale(maxArrowSize));
|
||||
double offset = fmin(length, DPIHelper::scale(maxArrowSize));
|
||||
QLineF unit = l.unitVector();
|
||||
QLineF normal = l.normalVector().unitVector();
|
||||
QPointF v(unit.dx(), unit.dy());
|
||||
|
||||
@@ -45,7 +45,9 @@ IFilterGUI* CopyFilterGUIFactory::createFilterGUI(QString& command, QString& par
|
||||
if (command == "Copy")
|
||||
{
|
||||
CopyFilterFactory factory;
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
|
||||
std::wstring commandWStr = command.toStdWString();
|
||||
std::wstring paramWStr = parameters.toStdWString();
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", commandWStr, paramWStr);
|
||||
if (!filters.empty())
|
||||
{
|
||||
CopyFilter* filter = (CopyFilter*)filters[0];
|
||||
|
||||
@@ -40,7 +40,9 @@ IFilterGUI* DelayFilterGUIFactory::createFilterGUI(QString& command, QString& pa
|
||||
if (command == "Delay")
|
||||
{
|
||||
DelayFilterFactory factory;
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
|
||||
std::wstring commandWStr = command.toStdWString();
|
||||
std::wstring paramWStr = parameters.toStdWString();
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", commandWStr, paramWStr);
|
||||
if (!filters.empty())
|
||||
{
|
||||
DelayFilter* filter = (DelayFilter*)filters[0];
|
||||
|
||||
@@ -64,7 +64,7 @@ void DeviceFilterGUI::load(const QString& parameters)
|
||||
}
|
||||
else
|
||||
{
|
||||
const QList<shared_ptr<AbstractAPOInfo> >& devices = factory->getDevices();
|
||||
const QList<shared_ptr<AbstractAPOInfo>>& devices = factory->getDevices();
|
||||
bool anyInstalled = false;
|
||||
for (const shared_ptr<AbstractAPOInfo>& apoInfo : devices)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ DeviceFilterGUIDialog::DeviceFilterGUIDialog(DeviceFilterGUI* gui, DeviceFilterG
|
||||
outputNode->setExpanded(true);
|
||||
QTreeWidgetItem* inputNode = new QTreeWidgetItem(ui->treeWidget, QStringList(tr("Capture devices")));
|
||||
inputNode->setExpanded(true);
|
||||
const QList<shared_ptr<AbstractAPOInfo> >& devices = factory->getDevices();
|
||||
const QList<shared_ptr<AbstractAPOInfo>>& devices = factory->getDevices();
|
||||
for (const shared_ptr<AbstractAPOInfo>& apoInfo : devices)
|
||||
{
|
||||
QStringList values;
|
||||
@@ -99,7 +99,7 @@ QString DeviceFilterGUIDialog::getPattern()
|
||||
{
|
||||
if (pattern != "")
|
||||
pattern += "; ";
|
||||
shared_ptr<AbstractAPOInfo> apoInfo = item->data(0, Qt::UserRole).value<shared_ptr<AbstractAPOInfo> >();
|
||||
shared_ptr<AbstractAPOInfo> apoInfo = item->data(0, Qt::UserRole).value<shared_ptr<AbstractAPOInfo>>();
|
||||
pattern += QString::fromStdWString(apoInfo->getDeviceString());
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ void DeviceFilterGUIDialog::on_showOnlyInstalledCheckBox_toggled(bool checked)
|
||||
for (int j = 0; j < groupItem->childCount(); j++)
|
||||
{
|
||||
QTreeWidgetItem* item = groupItem->child(j);
|
||||
shared_ptr<AbstractAPOInfo> apoInfo = item->data(0, Qt::UserRole).value<shared_ptr<AbstractAPOInfo> >();
|
||||
shared_ptr<AbstractAPOInfo> apoInfo = item->data(0, Qt::UserRole).value<shared_ptr<AbstractAPOInfo>>();
|
||||
item->setHidden(item->checkState(0) != Qt::Checked && !apoInfo->isInstalled() && checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ IFilterGUI* DeviceFilterGUIFactory::createFilterGUI(QString& command, QString& p
|
||||
return result;
|
||||
}
|
||||
|
||||
const QList<shared_ptr<AbstractAPOInfo> >& DeviceFilterGUIFactory::getDevices() const
|
||||
const QList<shared_ptr<AbstractAPOInfo>>& DeviceFilterGUIFactory::getDevices() const
|
||||
{
|
||||
return devices;
|
||||
}
|
||||
@@ -34,8 +34,8 @@ public:
|
||||
QList<FilterTemplate> createFilterTemplates() override;
|
||||
IFilterGUI* createFilterGUI(QString& command, QString& parameters) override;
|
||||
|
||||
const QList<std::shared_ptr<AbstractAPOInfo> >& getDevices() const;
|
||||
const QList<std::shared_ptr<AbstractAPOInfo>>& getDevices() const;
|
||||
|
||||
private:
|
||||
QList<std::shared_ptr<AbstractAPOInfo> > devices;
|
||||
QList<std::shared_ptr<AbstractAPOInfo>> devices;
|
||||
};
|
||||
@@ -52,7 +52,9 @@ IFilterGUI* GraphicEQFilterGUIFactory::createFilterGUI(QString& command, QString
|
||||
if (command == "GraphicEQ")
|
||||
{
|
||||
GraphicEQFilterFactory factory;
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
|
||||
std::wstring commandWStr = command.toStdWString();
|
||||
std::wstring paramWStr = parameters.toStdWString();
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", commandWStr, paramWStr);
|
||||
if (!filters.empty())
|
||||
{
|
||||
GraphicEQFilter* filter = (GraphicEQFilter*)filters[0];
|
||||
|
||||
@@ -62,7 +62,7 @@ void GraphicEQFilterGUIItem::paint(QPainter* painter, const QStyleOptionGraphics
|
||||
QFontMetrics metrics(font);
|
||||
painter->setFont(font);
|
||||
QString text = QString::number(index + 1);
|
||||
painter->drawText(-metrics.width(text) / 2, metrics.boundingRect('0').height() / 2, text);
|
||||
painter->drawText(-metrics.size(0, text).width() / 2, metrics.boundingRect('0').height() / 2, text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,9 @@ IFilterGUI* PreampFilterGUIFactory::createFilterGUI(QString& command, QString& p
|
||||
if (command == "Preamp")
|
||||
{
|
||||
PreampFilterFactory factory;
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
|
||||
std::wstring commandWStr = command.toStdWString();
|
||||
std::wstring paramWStr = parameters.toStdWString();
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", commandWStr, paramWStr);
|
||||
if (!filters.empty())
|
||||
{
|
||||
PreampFilter* filter = (PreampFilter*)filters[0];
|
||||
|
||||
@@ -433,31 +433,27 @@ void VSTPluginFilterGUI::updatePermissionWarning()
|
||||
{
|
||||
QByteArray bytes = QByteArray::fromBase64(QString::fromStdWString(chunkData).toUtf8());
|
||||
QString string = QString::fromUtf8(bytes.data(), bytes.length());
|
||||
QRegExp regexp("[A-Za-z]:(?:\\\\[\\w \\(\\)-]+)+\\.[A-Za-z]{3}");
|
||||
int offset = 0;
|
||||
while (offset >= 0)
|
||||
QRegularExpression regexp("[A-Za-z]:(?:\\\\[\\w \\(\\)-]+)+\\.[A-Za-z]{3}");
|
||||
QRegularExpressionMatchIterator it = regexp.globalMatch(string);
|
||||
while (it.hasNext())
|
||||
{
|
||||
offset = regexp.indexIn(string, offset);
|
||||
if (offset >= 0)
|
||||
QRegularExpressionMatch m = it.next();
|
||||
QString path = m.captured();
|
||||
QFile file(path);
|
||||
if (file.exists())
|
||||
{
|
||||
QString path = regexp.cap();
|
||||
QFile file(path);
|
||||
if (file.exists())
|
||||
ACCESS_MASK mask = GENERIC_READ;
|
||||
try
|
||||
{
|
||||
ACCESS_MASK mask = GENERIC_READ;
|
||||
try
|
||||
{
|
||||
mask = RegistryHelper::getFileAccessForUser(path.toStdWString(), SECURITY_LOCAL_SERVICE_RID);
|
||||
}
|
||||
catch (RegistryException e)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
if ((mask & GENERIC_READ) != GENERIC_READ && (mask & FILE_GENERIC_READ) != FILE_GENERIC_READ)
|
||||
files.append(path);
|
||||
mask = RegistryHelper::getFileAccessForUser(path.toStdWString(), SECURITY_LOCAL_SERVICE_RID);
|
||||
}
|
||||
offset += regexp.matchedLength();
|
||||
catch (RegistryException e)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
if ((mask & GENERIC_READ) != GENERIC_READ && (mask & FILE_GENERIC_READ) != FILE_GENERIC_READ)
|
||||
files.append(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,9 @@ IFilterGUI* VSTPluginFilterGUIFactory::createFilterGUI(QString& command, QString
|
||||
if (command == "VSTPlugin")
|
||||
{
|
||||
VSTPluginFilterFactory factory;
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", command.toStdWString(), parameters.toStdWString());
|
||||
std::wstring commandWStr = command.toStdWString();
|
||||
std::wstring paramWStr = parameters.toStdWString();
|
||||
std::vector<IFilter*> filters = factory.createFilter(L"", commandWStr, paramWStr);
|
||||
if (!filters.empty())
|
||||
{
|
||||
VSTPluginFilter* filter = (VSTPluginFilter*)filters[0];
|
||||
|
||||
+6
-6
@@ -47,17 +47,17 @@ int main(int argc, char* argv[])
|
||||
QSettings settings(QString::fromWCharArray(EDITOR_REGPATH), QSettings::NativeFormat);
|
||||
QVariant languageValue = settings.value("language");
|
||||
if (languageValue.isValid())
|
||||
QLocale::setDefault(languageValue.toString());
|
||||
QLocale::setDefault(QLocale(languageValue.toString()));
|
||||
else
|
||||
QLocale::setDefault(QLocale::system());
|
||||
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load(QLocale(), ":/translations/qtbase", "_");
|
||||
application.installTranslator(&qtTranslator);
|
||||
if (qtTranslator.load(QLocale(), ":/translations/qtbase", "_"))
|
||||
application.installTranslator(&qtTranslator);
|
||||
|
||||
QTranslator editorTranslator;
|
||||
editorTranslator.load(QLocale(), ":/translations/Editor", "_");
|
||||
application.installTranslator(&editorTranslator);
|
||||
if (editorTranslator.load(QLocale(), ":/translations/Editor", "_"))
|
||||
application.installTranslator(&editorTranslator);
|
||||
|
||||
QString configPath = QDir::currentPath();
|
||||
if (RegistryHelper::keyExists(APP_REGPATH) && RegistryHelper::valueExists(APP_REGPATH, L"ConfigPath"))
|
||||
@@ -82,7 +82,7 @@ int main(int argc, char* argv[])
|
||||
if (args.isEmpty() && w.isEmpty())
|
||||
args = QStringList("config.txt");
|
||||
|
||||
for (QString arg : args)
|
||||
for (const QString& arg : args)
|
||||
w.load(configDir.absoluteFilePath(arg));
|
||||
|
||||
w.doChecks();
|
||||
|
||||
@@ -35,7 +35,7 @@ QRectF ChannelGraphItem::boundingRect() const
|
||||
if (cachedRect.isNull())
|
||||
{
|
||||
QFontMetrics metrics(scene()->font());
|
||||
int width = metrics.width(name);
|
||||
int width = metrics.size(0, name).width();
|
||||
// we only use upper case characters and digits, so everything is above the baseline
|
||||
int height = metrics.ascent();
|
||||
// make it at least quadratic
|
||||
|
||||
@@ -63,7 +63,7 @@ void FrequencyPlotHRuler::paintEvent(QPaintEvent*)
|
||||
text = QString("%0").arg(hz);
|
||||
else
|
||||
text = QString("%0k").arg(hz / 1000);
|
||||
if (metrics.width(text) + 2 < s->hzToX(hz + hzBase) - x)
|
||||
if (metrics.size(0, text).width() + 2 < s->hzToX(hz + hzBase) - x)
|
||||
painter.drawText(x - topLeft.x() + offsetLeft + 1, 0, 0, height(), Qt::TextDontClip | Qt::AlignCenter, text);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ void FrequencyPlotHRuler::paintEvent(QPaintEvent*)
|
||||
void FrequencyPlotHRuler::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
FrequencyPlotView* view = qobject_cast<FrequencyPlotView*>(parentWidget());
|
||||
view->zoom(event->angleDelta().y(), 0, event->x() - view->viewportMargins().left(), 0);
|
||||
view->zoom(event->angleDelta().y(), 0, event->position().x() - view->viewportMargins().left(), 0);
|
||||
}
|
||||
|
||||
void FrequencyPlotHRuler::mouseMoveEvent(QMouseEvent* event)
|
||||
|
||||
@@ -101,5 +101,5 @@ void FrequencyPlotVRuler::wheelEvent(QWheelEvent* event)
|
||||
void FrequencyPlotVRuler::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
FrequencyPlotView* view = qobject_cast<FrequencyPlotView*>(parentWidget());
|
||||
view->setLastMousePos(QPoint(0, min(event->y(), view->viewport()->height() - 1)));
|
||||
view->setLastMousePos(QPoint(0, fmin(event->y(), view->viewport()->height() - 1)));
|
||||
}
|
||||
@@ -179,7 +179,7 @@ void FrequencyPlotView::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
event->accept();
|
||||
int delta = event->angleDelta().y();
|
||||
zoom(delta, delta, event->x(), event->y());
|
||||
zoom(delta, delta, event->position().x(), event->position().y());
|
||||
}
|
||||
|
||||
void FrequencyPlotView::scrollContentsBy(int dx, int dy)
|
||||
|
||||
@@ -28,7 +28,7 @@ MiddleClickTabBar::MiddleClickTabBar(QWidget* parent)
|
||||
|
||||
void MiddleClickTabBar::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::MidButton)
|
||||
if (event->button() == Qt::MiddleButton)
|
||||
{
|
||||
int tabIndex = tabAt(event->pos());
|
||||
if (tabIndex != -1)
|
||||
|
||||
@@ -40,8 +40,8 @@ QSize ResizingLineEdit::sizeHint() const
|
||||
QSize originalSize = QLineEdit::sizeHint();
|
||||
|
||||
QFontMetrics metrics = fontMetrics();
|
||||
QSize contentSize(metrics.width(text()), metrics.height());
|
||||
QStyleOptionFrameV2 opt;
|
||||
QSize contentSize(metrics.size(0, text()));
|
||||
QStyleOptionFrame opt;
|
||||
initStyleOption(&opt);
|
||||
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, contentSize, this);
|
||||
|
||||
Reference in new issue
Block a user