From 14935333454f590c0c6fdb832c98eecb3ee2c313 Mon Sep 17 00:00:00 2001 From: Autechre Date: Tue, 26 Apr 2022 13:22:33 +0100 Subject: [PATCH] Revert "ensure history list will contain crc32 (#13883)" (#13891) This reverts commit 141bba0464d27b5c7b7cbb17830f314f6e2b05ed. --- ui/drivers/ui_qt.cpp | 29 ++--------------------------- ui/drivers/ui_qt.h | 2 -- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/ui/drivers/ui_qt.cpp b/ui/drivers/ui_qt.cpp index eaf1710d8f..40bf8e4096 100644 --- a/ui/drivers/ui_qt.cpp +++ b/ui/drivers/ui_qt.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include "ui_qt.h" #include "qt/gridview.h" @@ -83,7 +82,6 @@ extern "C" { #include "../../command.h" #include "../ui_companion_driver.h" #include "../../configuration.h" -#include "../../encodings/crc32.h" #include "../../frontend/frontend.h" #include "../../frontend/frontend_driver.h" #include "../../file_path_special.h" @@ -2601,7 +2599,7 @@ void MainWindow::onFileDoubleClicked(const QModelIndex &proxyIndex) if (m_fileModel->isDir(index)) m_dirTree->setCurrentIndex(m_dirModel->index(m_fileModel->filePath(index))); else - loadContent(getFileContentHashWithCRC32(index)); + loadContent(getFileContentHash(index)); } void MainWindow::selectBrowserDir(QString path) @@ -2672,29 +2670,6 @@ QHash MainWindow::getFileContentHash(const QModelIndex &index) return hash; } -QHash MainWindow::getFileContentHashWithCRC32(const QModelIndex &index) -{ - QHash hash = getFileContentHash(index); - hash["crc32"] = getFileCRC32(hash["path"]); - return hash; -} - -QString MainWindow::getFileCRC32(const QString &path) -{ - QString crc32; - QFile file(path); - if (file.exists() && file.open(QIODevice::ReadOnly)) { - const QByteArray buf = file.readAll(); - file.close(); - crc32 = QString::number(encoding_crc32(0, (const uint8_t *) buf.data(), buf.size()), 16).toUpper(); - while (crc32.length() < 8) { - crc32 = crc32.prepend('0'); - } - } - - return crc32; -} - void MainWindow::onContentItemDoubleClicked(const QModelIndex &index) { Q_UNUSED(index); @@ -2958,7 +2933,7 @@ void MainWindow::onRunClicked() switch (m_currentBrowser) { case BROWSER_TYPE_FILES: - contentHash = getFileContentHashWithCRC32( + contentHash = getFileContentHash( m_proxyFileModel->mapToSource(m_fileTableView->currentIndex())); break; case BROWSER_TYPE_PLAYLISTS: diff --git a/ui/drivers/ui_qt.h b/ui/drivers/ui_qt.h index 469fdea2c2..3763dd4a98 100644 --- a/ui/drivers/ui_qt.h +++ b/ui/drivers/ui_qt.h @@ -398,8 +398,6 @@ public: QModelIndex getCurrentContentIndex(); QHash getCurrentContentHash(); QHash getFileContentHash(const QModelIndex &index); - QHash getFileContentHashWithCRC32(const QModelIndex &index); - QString getFileCRC32(const QString &path); static double lerp(double x, double y, double a, double b, double d); QString getSpecialPlaylistPath(SpecialPlaylist playlist); QVector > getPlaylists();