From 3981b1cc82c90805726594c86d7a17fab2f41913 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 12 May 2020 08:02:55 +0200 Subject: [PATCH] (Qt) Cleanups --- ui/drivers/qt/ui_qt_load_core_window.cpp | 18 ++++++++---------- ui/drivers/qt/ui_qt_window.cpp | 21 +++++---------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/ui/drivers/qt/ui_qt_load_core_window.cpp b/ui/drivers/qt/ui_qt_load_core_window.cpp index a728bdead2..53c7b26147 100644 --- a/ui/drivers/qt/ui_qt_load_core_window.cpp +++ b/ui/drivers/qt/ui_qt_load_core_window.cpp @@ -41,7 +41,7 @@ extern "C" { } #endif -#define CORE_NAME_COLUMN 0 +#define CORE_NAME_COLUMN 0 #define CORE_VERSION_COLUMN 1 LoadCoreTableWidget::LoadCoreTableWidget(QWidget *parent) : @@ -150,18 +150,16 @@ void LoadCoreWindow::loadCore(const char *path) void LoadCoreWindow::onCoreEnterPressed() { - QTableWidgetItem *selectedCoreItem = NULL; - QString path; QByteArray pathArray; - const char *pathData = NULL; - QVariantHash hash; - - selectedCoreItem = m_table->item(m_table->currentRow(), CORE_NAME_COLUMN); - hash = selectedCoreItem->data(Qt::UserRole).toHash(); - path = hash["path"].toString(); + const char *pathData = NULL; + QTableWidgetItem *selectedCoreItem = + m_table->item(m_table->currentRow(), CORE_NAME_COLUMN); + QVariantHash hash = selectedCoreItem->data( + Qt::UserRole).toHash(); + QString path = hash["path"].toString(); pathArray.append(path); - pathData = pathArray.constData(); + pathData = pathArray.constData(); loadCore(pathData); } diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index 124ea19d0c..9b97768b71 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -151,13 +151,11 @@ static void scan_finished_handler(retro_task_t *task, /* https://stackoverflow.com/questions/7246622/how-to-create-a-slider-with-a-non-linear-scale */ static double expScale(double inputValue, double midValue, double maxValue) { - double returnValue = 0; - double M = maxValue / midValue; - double C = log(pow(M - 1, 2)); - double B = maxValue / (exp(C) - 1); - double A = -1 * B; - - returnValue = A + B * exp(C * inputValue); + double M = maxValue / midValue; + double C = log(pow(M - 1, 2)); + double B = maxValue / (exp(C) - 1); + double A = -1 * B; + double returnValue = A + B * exp(C * inputValue); return returnValue; } @@ -2891,15 +2889,6 @@ void MainWindow::updateItemsCount() void MainWindow::keyPressEvent(QKeyEvent *event) { -#if 0 - if (event->key() == Qt::Key_F5) - { - event->accept(); - hide(); - - return; - } -#endif QMainWindow::keyPressEvent(event); }