Fixed: When a file was selected for the Include command in the Configuration Editor that was not readable by the audio service, no warning appeared.
Fixed: When the Include command was used to load the configuration file itself or another file including the file, Equalizer APO could crash. The recursion depth is now limited to 100.
This commit is contained in:
1 parent
3d8ef28d1b
commit
f014bf4b7d
7 files changed
+249
-108
No files matched your search
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "helpers/RegistryHelper.h"
|
||||
#include "IncludeFilterGUI.h"
|
||||
#include "ui_IncludeFilterGUI.h"
|
||||
|
||||
@@ -28,6 +29,8 @@ IncludeFilterGUI::IncludeFilterGUI(FilterTable* filterTable, const QString& path
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->pathLineEdit->setText(path);
|
||||
|
||||
updateFileInfo();
|
||||
}
|
||||
|
||||
IncludeFilterGUI::~IncludeFilterGUI()
|
||||
@@ -61,6 +64,7 @@ void IncludeFilterGUI::on_selectFileToolButton_clicked()
|
||||
if (relativePath.startsWith("../../"))
|
||||
relativePath = absolutePath;
|
||||
ui->pathLineEdit->setText(QDir::toNativeSeparators(relativePath));
|
||||
updateFileInfo();
|
||||
|
||||
emit updateModel();
|
||||
}
|
||||
@@ -68,6 +72,8 @@ void IncludeFilterGUI::on_selectFileToolButton_clicked()
|
||||
|
||||
void IncludeFilterGUI::on_pathLineEdit_editingFinished()
|
||||
{
|
||||
updateFileInfo();
|
||||
|
||||
emit updateModel();
|
||||
}
|
||||
|
||||
@@ -83,3 +89,44 @@ void IncludeFilterGUI::on_openFileToolButton_clicked()
|
||||
filterTable->openConfig(fileInfo.absoluteFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
void IncludeFilterGUI::updateFileInfo()
|
||||
{
|
||||
QString error = "";
|
||||
|
||||
QString path = ui->pathLineEdit->text();
|
||||
if (path.length() == 0)
|
||||
{
|
||||
error = tr("No file selected");
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileInfo fileInfo(filterTable->getConfigPath());
|
||||
QDir configDir = fileInfo.absoluteDir();
|
||||
fileInfo.setFile(configDir, path);
|
||||
if (!fileInfo.exists())
|
||||
{
|
||||
error = tr("File not found");
|
||||
}
|
||||
else
|
||||
{
|
||||
path = QDir::toNativeSeparators(fileInfo.absoluteFilePath());
|
||||
|
||||
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)
|
||||
error = tr("The file is not readable for the audio service.\nChange the file permissions or copy the file to the config directory.");
|
||||
}
|
||||
}
|
||||
|
||||
ui->errorLabel->setVisible(error.length() > 0);
|
||||
ui->errorLabel->setText(error);
|
||||
}
|
||||
@@ -42,6 +42,8 @@ private slots:
|
||||
void on_openFileToolButton_clicked();
|
||||
|
||||
private:
|
||||
void updateFileInfo();
|
||||
|
||||
Ui::IncludeFilterGUI* ui;
|
||||
FilterTable* filterTable;
|
||||
};
|
||||
@@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,1,0">
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,1,0,0">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -26,28 +26,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="includeLabel">
|
||||
<property name="text">
|
||||
<string>Include:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="ResizingLineEdit" name="pathLineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="selectFileToolButton">
|
||||
<property name="text">
|
||||
<string>Select file</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Editor.qrc">
|
||||
<normaloff>:/icons/document-open.ico</normaloff>:/icons/document-open.ico</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -71,6 +50,71 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="ResizingLineEdit" name="pathLineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="selectFileToolButton">
|
||||
<property name="text">
|
||||
<string>Select file</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Editor.qrc">
|
||||
<normaloff>:/icons/document-open.ico</normaloff>:/icons/document-open.ico</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="includeLabel">
|
||||
<property name="text">
|
||||
<string>Include:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="errorLabel">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>120</red>
|
||||
<green>120</green>
|
||||
<blue>120</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
Reference in new issue
Block a user